使用 Interface Builder 将一个视图连接到单独 NIB 中的另一个视图

发布于 2024-11-24 03:47:54 字数 549 浏览 2 评论 0原文

我有一个自定义 UIWindow 类,它有一个 IBOutlet

@interface MyWindow
    IBOutlet UIView * someView;
    id <MyWindowDelegate> delegate; 
    // to inform a controller something happened to view
@end

@interface MyControllerThatContainsSomeView
    IBOutlet UIWebView * theConcreteView;
@end

我已将 MainWindow.xib 中的窗口更改为 MyWindow。有没有一种方法,通过界面生成器,我可以从 MyControllerThatContainsSomeView.xib 引用 someView

所以,MainWindow.MyWindow.someView -> MyControllerThatContainsSomeView.theConcreteView

I have a custom UIWindow class that has an IBOutlet

@interface MyWindow
    IBOutlet UIView * someView;
    id <MyWindowDelegate> delegate; 
    // to inform a controller something happened to view
@end

@interface MyControllerThatContainsSomeView
    IBOutlet UIWebView * theConcreteView;
@end

I have changed my Window in MainWindow.xib to MyWindow. Is there a way, through interface builder, in which I can reference someView from MyControllerThatContainsSomeView.xib

so, MainWindow.MyWindow.someView -> MyControllerThatContainsSomeView.theConcreteView

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

中性美 2024-12-01 03:47:54

您可以在绑定路径中引用它,但仅此而已。通常,当您发现需要从一种视图引用另一种视图时,就需要重新考虑您的设计了。视图应该引用向视图提供数据的模型对象。

You can refer to it in a binding path but that's about it. Usually when you find that you need to refer from one view to another, it's time to rethink your design. Views should refer instead to model objects which provide data to the views.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文