修改navigationBar

xiaoxiao2021-02-28  14

- (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]}]; }
转载请注明原文地址: https://www.6miu.com/read-450125.html

最新回复(0)