カスタムの戻るボタンにこれらのコードを使用しています
UIImage *buttonImage = [UIImage imageNamed:@"back-button-2.png"];
//create the button and assign the image
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
//set the frame of the button to the size of the image (see note below)
button.frame = CGRectMake(0, 0, buttonImage.size.width, buttonImage.size.height);
[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;
これがバック機能です
-(void)back {
// Tell the controller to go back
[self.navigationController popViewControllerAnimated:YES];
}
カスタムの戻るボタンが表示されますが、機能していません。