我正在爲UINavigationBar的自定義欄按鈕查看,我使用下面的代碼定製的UIBarButtonItem在UINavigationBar的
UIImageView *backImgView= [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"chk_back.png"]]; [backImgView setUserInteractionEnabled:YES];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:backImgView];
[backButton setTarget:self];
[backButton setAction:@selector(BackBtn)];
checkIn_NavBar.topItem.leftBarButtonItem = backButton;
的問題是它沒有調用它的行動。我做錯了什麼?
我可以在您的BackBtn方法上看到嗎? – Arthur
什麼是checkIn_NavBar?你有強烈的參考意見嗎?爲什麼不使用self.navigationItem.leftBarButtonItem? –
嘗試使用[checkIn_NavBar setLeftBarButtonItem:backButton];或self.navigationItem.leftBarButtonItem = backButton; – Bonnie