修改navigationBar

来源:互联网 发布:腾讯云阿里云哪个好 编辑:程序博客网 时间:2024/05/27 21:09
- (void)viewDidLoad {    [self setNavgation]; //需要在}-(void) setNavgation{    self.navigationItem.hidesBackButton = YES;//可以隐藏原有的导航栏返回按钮    //设置的按钮会显示在导航栏左边,返回按钮的位置    UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"activity_back.png"] style:UIBarButtonItemStylePlain target:self action:@selector(backViewcontroller)];    self.navigationItem.leftBarButtonItem = barButtonItem;    UINavigationBar *bar = [UINavigationBar appearance];    //设置显示的颜色    bar.barTintColor = [UIColor clearColor];    //设置字体颜色    bar.tintColor = [UIColor whiteColor];    [bar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];}