I have a navigationItem
with a titleView
. Now in some conditions I want to use the title
property for that navigationItem
. How to do that? Any idea?
Here is what I have tried, however is not working:
self.revealViewController().navigationItem.titleView = UIView.init()
self.revealViewController().navigationItem.title = "My Item"
在设置标题之前,需要将titleView设置为nil。
在您的ViewController的viewdidload
中,您可以设置标题,例如
self.title = "your title"
UIView* titleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 40)];
//titleView.backgroundColor=[UIColor redColor];
self.navigationItem.titleView=titleView;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.