想要在navigation controller 的頂端條添加一個(gè)刷新鍵。不知道為什么不執(zhí)行。hearder代碼:@interface PropertyViewController : UINavigationController {}添加button代碼:(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Show" style:UIBarButtonItemStylePlain
target:self action:@selector(refreshPropertyList:)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
return self;
}
不知道錯(cuò)誤在哪兒
2 回答

天涯盡頭無女友
TA貢獻(xiàn)1831條經(jīng)驗(yàn) 獲得超9個(gè)贊
你可以斷點(diǎn)看看,這段代碼有沒有執(zhí)行。初始化方法有多個(gè),檢查一下調(diào)用的對(duì)不對(duì)?

人到中年有點(diǎn)甜
TA貢獻(xiàn)1895條經(jīng)驗(yàn) 獲得超7個(gè)贊
將initWithNibName:bundle:替換為initWithRootViewController:
- 2 回答
- 0 關(guān)注
- 799 瀏覽
添加回答
舉報(bào)
0/150
提交
取消