I am trying to use various ways to change the image of UIBarButtonItem when it was clicked, with no luck.
// bookmarkButton is a property linked up in IB -(IBAction)bookmarkButtonTapped:(id)sender { NSLog(@"this action triggers"); // attempt 1 UIBarButtonItem* aBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"bookmarkdelete.png"] style:UIBarButtonItemStylePlain target:self action:@selector(bookmarkButtonTapped:)]; bookmarkButton = aBarButtonItem; [aBarButtonItem release]; // attempt 2 bookmarkButton.image = [UIImage imageNamed:@"bookmarkdelete.png"]; }
Is there any other way to do this?
ios objective-c iphone uibarbuttonitem
cannyboy
source share