问题
My idea is to create a semi-transparent view like whatsapp does.
1) I have a tap gesture on image view.
2) When I tap on the image view, one layer of transparent view like whatsapp will appear
3) I then have three button - take new, choose existing or cancel.

How do I continue from here? When I press cancel it should pop away the semi-transparent ui view..
回答1:
why dont you use UIActionSheet....try something like...
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take photo",@"Choose existing", nil];
actionSheet.actionSheetStyle=UIActionSheetStyleBlackTranslucent;
[actionSheet showFromRect:[sender frame] inView:self.view animated:YES];
also implement the action in the delegate method.....
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
// create an image picker controller
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
if(buttonIndex==0)
{
//create image picker with source camera blah blah
}
else if(buttonIndex==1)
{
//choose existing...
}
}
you will get something like>>

来源:https://stackoverflow.com/questions/19789938/how-to-do-a-semi-transparent-modal-segue-like-whatsapp-take-photo-choose-e