如何进行类似"Whatsapp"的半透明模态搜索?-“拍照/选择现有照片"; [英] How to do a semi-transparent modal segue like "Whatsapp" - "Take Photo/ Choose Existing Photo"
本文介绍了如何进行类似"Whatsapp"的半透明模态搜索?-“拍照/选择现有照片";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的想法是创建一个类似于whatsapp的半透明视图.
My idea is to create a semi-transparent view like whatsapp does.
1)我在图像视图上有一个轻击手势.
1) I have a tap gesture on image view.
2)当我点击图像视图时,将出现一层透明的视图,如whatsapp
2) When I tap on the image view, one layer of transparent view like whatsapp will appear
3)然后,我有三个按钮-选择新按钮,选择现有按钮或取消按钮.
3) I then have three button - take new, choose existing or cancel.
如何从这里继续?当我按取消"时,它应该会弹出半透明的ui视图.
How do I continue from here? When I press cancel it should pop away the semi-transparent ui view..
推荐答案
为什么不使用UIActionSheet....尝试类似...
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...
}
}
您将得到类似>>
这篇关于如何进行类似"Whatsapp"的半透明模态搜索?-“拍照/选择现有照片";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文