20
我發現了很多圍繞導航欄放置按鈕的主題,但都沒有告訴我如何在酒吧中心放置一個按鈕。 我發現了一個分段控件的例子,但我不需要它。如何添加一個簡單的按鈕到導航欄的中間?
只是一個按鈕,而不是標題。那可能嗎? ;-)
編輯:
這將做到這一點:
UIButton *titleButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[titleButton setFrame:CGRectMake(0, 0, 170, 35)];
self.navigationItem.titleView = titleButton;
哦,我總是忘了設置框架!謝謝 – madmax 2011-03-25 15:33:02