IOS UINavigationController 更改返回按鈕


UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];  

back.titleLabel.font = [UIFont boldSystemFontOfSize:13]; 

[back setTitle:@"Back" forState:UIControlStateNormal];  

[back setFrame:CGRectMake(5, 2, 52, 30)];  

[back setBackgroundImage:[UIImage imageNamed:@"bar_return"] forState:UIControlStateNormal];  

[back addTarget:self action:@selector(popDiyView) forControlEvents:UIControlEventTouchUpInside];  

UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithCustomView:back];  

self.navigationItem.leftBarButtonItem = barButton; 

 

修改導航欄背景  和導航欄標題顏色

[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:46/255.0 green:46/255.0 blue:56/255.0 alpha:1.0]];
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM