使用 Interface Builder 将一个视图连接到单独 NIB 中的另一个视图
我有一个自定义 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在绑定路径中引用它,但仅此而已。通常,当您发现需要从一种视图引用另一种视图时,就需要重新考虑您的设计了。视图应该引用向视图提供数据的模型对象。
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.