[英]How to do a semi-transparent modal segue like “Whatsapp” - “Take Photo/ Choose Existing Photo”
My idea is to create a semi-transparent view like whatsapp does. 我的想法是创建一个类似于whatsapp的半透明视图。
1) I have a tap gesture on image view. 1)我在图像视图上有一个轻击手势。
2) When I tap on the image view, one layer of transparent view like whatsapp will appear 2)当我点击图像视图时,将出现一层透明的视图,如whatsapp
3) I then have three button - take new, choose existing or cancel. 3)然后,我有三个按钮-选择新按钮,选择现有按钮或取消按钮。
How do I continue from here? 我如何从这里继续? When I press cancel it should pop away the semi-transparent ui view..
当我按取消时,它应该会弹出半透明的ui视图。
why dont you use UIActionSheet....try something like... 你为什么不使用UIActionSheet ....尝试类似...
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>> 你会得到类似>>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.