AT certain point in my class ABC, I want to display a UIViewController. ABC itself is not a subclass of UIViewController, hence I cant do
[self.navigationController pushViewController:myViewController animated:NO]
Is there a way to ge开发者_JS百科t a reference to the currently visible UIViewController (top of navigation stack)
UINavigationController :
@property(nonatomic, readonly, retain) UIViewController *topViewController
The view controller at the top of the navigation stack. (read-only)
@property(nonatomic, readonly, retain) UIViewController *visibleViewController
The view controller associated with the currently visible view in the navigation interface. (read-only)
The currently visible view can belong either to the view controller at the top of the navigation stack or to a view controller that was presented modally.
I solved it by creating a static reference to RootViewController in my AppDelegate and accessing them through static methods.
精彩评论