I'm trying to identify the Navigation Bar in the current view so that I can add a subview to it.
I h开发者_如何学JAVAave seen this code which is able to identify the Navigation Bar that has been dynamically created and tagged:
UINavigationBar *theNavigationBar = (UINavigationBar *)[inParent.view viewWithTag:kNavigationBarTag];
But in my case the Navigation bar is not being created dynamically, so it's not tagged. Is there a way to identify it otherwise?
self.navigationController.navigationBar
Only valid when called from a method in a UIViewController, of course. Otherwise, try to retrieve a reference to the view controller and take it from there.
You set the tag property for UINavigationBar if you create or access it from your UIViewController (self.navigationController.navigationBar )
because tag is the property of UIView which is the super class for UINavigationBar ,
May be you are referring code from the below blog post ...
http://iphonesdevsdk.blogspot.com/
加载中,请稍侯......
精彩评论