Custom navigationBar on moreNavigationController

故事扮演 提交于 2019-12-13 03:48:58

问题


Hot to customize navigation bar that appear on "More" tab in UITabBarController to have 2 px line (in different color) as bottom border?

I created subclass of the UINavigationBar that overrides drawrect: method with drawing of that line, and that works for first four tabs, except tabs that are under more navigation controller.

Any help?


回答1:


#import <objc/runtime.h>

And dynamically set the class of the more view controller's navigation bar:

object_setClass(yourTabBarController.moreNavigationController.navigationBar, 
                [YourNavigationBarSubClass class]);



回答2:


If you wanna change the background image you can do it inserting a UIImageView in the default navigation bar

[self.navigationController.navigationBar addSubview:[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"navBar"]]];


来源:https://stackoverflow.com/questions/5217612/custom-navigationbar-on-morenavigationcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!