![](/img/trans.png)
[英]iPhone - Change target or selector for Back Button on UINavigationController
[英]How to change back bar button's width of a UINavigationController in iPhone?
我有兩個表視圖控制器。 說出TableViewController1和TableViewController2 。
當有人單擊TableViewController1的單元格時,我按下TableViewController2 。
我將TableViewController1的單擊單元格的值設置為TableViewController2的后欄按鈕的標題值。
根據TableViewController1單元格字符串的長度,后退按鈕的長度也會改變。
可以固定后退按鈕的寬度嗎? 我真的需要這個,因為我想捕獲TableViewController2導航欄的titleView的tap事件。
后退欄按鈕的寬度會影響titleView的寬度。 所以我找不到titleView的邊界。 還是有其他方法可以找到導航欄titleView的bounds值?
可以固定后退按鈕的寬度嗎?
據我了解,您無法編輯此按鈕。
將其子類化是一種方法,或者您可能想從上一個viewController中截斷標題。 另外,您可能希望用普通的UIBarButtonItem替換為:
- (void) viewDidLoad
{
[super viewDidLoad];
self.title = @”shortTitle.”;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.