Question

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. Storyboard

How do I continue from here? When I press cancel it should pop away the semi-transparent ui view..

Was it helpful?

Solution

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>>

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top