狀態欄和導航欄設置備忘

- (void)viewWillAppear:(BOOL)animated{app

    [super viewWillAppear:YES];it

[self.navigationController.navigationBar setBarTintColor:[UIColor blackColor]];//導航欄背景色io

[self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];//導航欄標題顏色im

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];//狀態欄顏色dict

}animate

- (UIStatusBarStyle)preferredStatusBarStyle{di

    //設置狀態欄前景色(須要與[self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];組合使用)view

    return UIStatusBarStyleLightContent;vi

}return

- (void)viewWillDisappear:(BOOL)animated{

    [super viewWillDisappear:YES];

    //本界面消失時 讓導航欄啥的都還原

    [self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]];//導航欄背景色

    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor blackColor],NSForegroundColorAttributeName,nil]];//導航欄標題顏色

    [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault];

}

相關文章
相關標籤/搜索