NavigationController

1.BackButton的隱藏

self.navigationItem.hidesBackButton = YES;

2.給push進(jìn)去的導(dǎo)航欄的backButton去掉標(biāo)題,只留“<” 符號(hào)

UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc]init];

backButtonItem.title = @"";

self.navigationItem.backBarButtonItem = backButtonItem;

3.自定義導(dǎo)航欄按鈕(右)? 必須給btn設(shè)置UIButtonTypeCustom

UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];

[rightBtn setFrame:CGRectMake(0, 0, 60, 22)];

[rightBtn setTitle:@"下一頁(yè)" forState:UIControlStateNormal];

[rightBtn setBackgroundColor:[UIColor redColor]];

[rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *rightButton = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];

self.navigationItem.rightBarButtonItem = rightButton;

4.導(dǎo)航控制器欄的背景顏色

self.navigationController.navigationBar.barTintColor = color;

5.導(dǎo)航欄自帶按鈕和按鈕文字的顏色

self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

6.設(shè)置導(dǎo)航控制器標(biāo)題的顏色和字體大小等...(設(shè)置后,子控制器的標(biāo)題都沿用改設(shè)置)

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:

[UIColor whiteColor],NSForegroundColorAttributeName, [UIFont systemFontOfSize:a],NSFontAttributeName,nil];

[self.navigationController.navigationBar setTitleTextAttributes:attributes];

7.額外改變導(dǎo)航欄標(biāo)題(越過tableItem控制器title)

self.navigationItem.title = @"CEO特訓(xùn)";

8.自帶按鈕(右)

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:@selector(rightBtn)];

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容