タブバーを持たないViewControllerでは動作しますが、タブバーでは動作しません。また、これはストーリー ボードの最初のビュー コントローラーです。
UIImage *bookmarkImage = [UIImage imageNamed:@"bookmark"];
//create the button and assign the image
UIButton *bookmarkButton = [UIButton buttonWithType:UIButtonTypeCustom];
//set the frame of the button to the size of the image (see note below)
bookmarkButton.frame = CGRectMake(100, 0, bookmarkImage.size.width, bookmarkImage.size.height);
[bookmarkButton setImage:bookmarkImage forState:UIControlStateNormal];
bookmarkButton addTarget:self action:@selector(addFavorite:) forControlEvents:UIControlEventTouchUpInside];
bookmarkButton.imageView.contentMode=UIViewContentModeScaleAspectFit;
//create a UIBarButtonItem with the button as a custom view
UIBarButtonItem *customBarItem2 = [[UIBarButtonItem alloc] initWithCustomView:bookmarkButton];
self.navigationItem.rightBarButtonItem = customBarItem2;