的後退按鈕我有這樣的代碼,如果我把它放在viewDidLoad方法,它工作正常,改變我的UINavigationBar的改變UINavigationBar的
// Set the custom back button
UIImage *buttonImage = [UIImage imageNamed:@"backag.png"];
//create the button and assign the image
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"selback.png"] forState:UIControlStateHighlighted];
button.adjustsImageWhenDisabled = NO;
//set the frame of the button to the size of the image (see note below)
button.frame = CGRectMake(0, 0, 30, 30);
[button addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
//create a UIBarButtonItem with the button as a custom view
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = customBarItem;
// Cleanup
[customBarItem release];
的後退按鈕。但是,當我加載下一個視圖時,舊式樣按鈕顯示出來。爲了解決這個問題,我試着把這段代碼放到下一個視圖的viewDidLoad方法中,但是沒有看到任何按鈕。
有關可能會導致此問題的任何想法?
謝謝!