开发者

Connect one view to another in seperate NIBs using Interface Builder

开发者 https://www.devze.com 2023-03-20 10:29 出处:网络
I have a custom UIWindow class that has an IBOutlet @interface MyWindow IBOutlet UIView * someView; id <MyWindowDelegate> delegate;

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
开发者_StackOverflow中文版@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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消