开发者

Custom navigationBar on moreNavigationController

开发者 https://www.devze.com 2023-02-15 10:02 出处:网络
Hot to customize navigation bar that appear on \"More\" tab in UITabBarController to have 2 px line (开发者_开发百科in different color) as bottom border?

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?

Custom navigationBar on moreNavigationController


#import <objc/runtime.h>

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

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


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"]]];
0

精彩评论

暂无评论...
验证码 换一张
取 消