UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(rightButtonAction:)];
self.navigationItem.rightBarButtonItem = rightButton;
iPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
UIPopoverController *popOver = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popOver.delegate =self;
[popOver presentPopoverFromRect:CGRectMake(self.view.frame.size.width, 0, 0, 0) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
iPhone
- (void)rightButtonAction:(id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Select" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"What" otherButtonTitles:nil, nil]; [actionSheet showInView:self.view]; [actionSheet release]; } -(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; switch (buttonIndex) { case 0: { picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentModalViewController:picker animated:YES]; } break; default: break; } }