/*
// 系統箭頭樣式
UIBarButtonSystemItemPlay
*/
UIBarButtonItem * rightBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(rightButton)];
self.navigationItem.rightBarButtonItem = rightBtn;php
// right itme (變相讓按鈕靠右)
UIButton * rightItemButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 40)];
// 設置 寬高 (需倒入工具類)
//rightItemButton = CGSizeMake(100, 40);
/*
// 加上邊框
[rightItemButton.layer setBorderWidth:1.0f];
// 圓角
[rightItemButton.layer setCornerRadius:4.0f];
// 邊框顏色
[rightItemButton.layer setBorderColor:[UIColor blackColor].CGColor];
*/
[rightItemButton setTitle:@"下一步" forState:UIControlStateNormal];
// 字體大小
rightItemButton.titleLabel.font = [UIFont systemFontOfSize:20];
// 顏色
[rightItemButton setTitleColor:[UIColor colorWithRed:0.000 green:0.431 blue:0.427 alpha:1.000] forState:UIControlStateNormal];
// 居中
[rightItemButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
// 添加點擊事件
[rightItemButton addTarget:self action:@selector(backButtonClick:) forControlEvents:UIControlEventTouchUpInside];
// 第一次見
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:rightItemButton];
// 狀態 做用不明
//[rightButton setStyle:UIBarButtonItemStyleDone];
// 設置 右邊time 爲
[self.navigationItem setRightBarButtonItem:rightButton];
html
學自:http://www.cocoachina.com/bbs/read.php?tid-298084.html
ide