Is it possible to access UIView in MainWindow.xib using tag
There are 2 UIView in my MainWindow.Xib One is the outlet of RootViewController view, another UIView is that I hope to access using tag (123) from the source codes of RootViewController. If the second UIView is the sub view of the first view, I know I can use
[self.view viewWithTag:123];
But I do not know how to handle this case when the UIView that hope to be accessed is not the sub view of current view.

Welcome any com开发者_StackOverflow社区ment
Thanks
interdev
tag is specific to a UIView hierarchy (see Return value on UIView's viewWithTag:). Since there is no hierarchy between two separate views, you cannot use it.
Instead, do what phix23 suggests and add an IBOutlet for your second view in your RootViewController, i.e.:
RootViewController.h
@interface RootViewController : UIViewController {
// ...
}
// @synthesize in RootViewController.m (don't forget to dealloc)
@property (nonatomic, retain) IBOutlet UIView *secondView;
Then hook that up in your XIB-file.
加载中,请稍侯......
精彩评论