亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在UINavigationController中添加向右按鈕?

如何在UINavigationController中添加向右按鈕?

iOS
Helenr 2018-12-16 17:17:45
想要在navigation controller 的頂端條添加一個刷新鍵。不知道為什么不執行。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; } 不知道錯誤在哪兒
查看完整描述

2 回答

?
天涯盡頭無女友

TA貢獻1831條經驗 獲得超9個贊

你可以斷點看看,這段代碼有沒有執行。初始化方法有多個,檢查一下調用的對不對?


查看完整回答
反對 回復 2018-12-19
?
人到中年有點甜

TA貢獻1895條經驗 獲得超7個贊

將initWithNibName:bundle:替換為initWithRootViewController:


查看完整回答
反對 回復 2018-12-19
  • 2 回答
  • 0 關注
  • 797 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號