如何做一个像“Whatsapp” – “拍照/select现有的照片”半透明模态赛格
我的想法是像whatsapp那样创build一个半透明的视图。
1)我有一个点击手势图像视图。
2)当我点击图像视图,像whatsapp将出现一个透明的视图层
3)然后我有三个button – 采取新的,select存在或取消。
我如何从这里继续? 当我按取消它应该popup半透明的UI视图..
为什么不使用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];
在委托方法中也执行动作…..
-(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... } }
你会得到像>>一样