
所以我想删除捕获按钮旁边的默认取消按钮,但我不想删除相机单击按钮.我做过研究,但我找不到完美的答案.我已经使用了以下代码,但它也删除了单击按钮.
[picker setShowsCameraControls:YES];解决方法 我觉得你应该为你的uiimagepickercontroller添加自定义CameraOverlayVIEw并隐藏CameraControls.This不会显示你的取消按钮.
picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControllerSourceTypeCamera; [picker setShowsCameraControls:NO]; CGRect screenBounds= [UIScreen mainScreen].bounds ; UIVIEw *overlayVIEw = [[UIVIEw alloc] initWithFrame:screenBounds]; [overlayVIEw setautoresizesSubvIEws:YES]; [overlayVIEw setautoresizingMask:UIVIEwautoresizingFlexibleWIDth|UIVIEwautoresizingFlexibleHeight|UIVIEwautoresizingFlexibleBottommargin|UIVIEwautoresizingFlexibletopmargin|UIVIEwautoresizingFlexibleleftmargin|UIVIEwautoresizingFlexibleRightmargin]; UIbutton *capturebutton=[[UIbutton alloc]initWithFrame:CGRectMake(screenBounds.size.wIDth/2-30,screenBounds.size.height-60,60,60)];[capturebutton addTarget:self action:@selector(captureImage:) forControlEvents:UIControlEventtouchUpInsIDe];[capturebutton setBackgroundImage:[UIImage imagenamed:@"icon"] forState:UIControlStatenormal];[overlayVIEw addSubvIEw:capturebutton];[picker setCameraOverlayVIEw:overlayVIEw];[picker setCameraDevice:UIImagePickerControllerCameraDeviceRear]; [self presentVIEwController:picker animated:YES completion:NulL];
这是Capture按钮的动作.
-(voID)captureImage:(UIbutton*)sender{[picker takePicture];} 并使用此委托方法获取图像.
-(voID)imagePickerController:(UIImagePickerController *)picker dIDFinishPickingMediawithInfo:(NSDictionary *)info{ [picker dismissVIEwControllerAnimated:YES completion:nil];} 总结 以上是内存溢出为你收集整理的ios – 从自定义相机中删除取消按钮全部内容,希望文章能够帮你解决ios – 从自定义相机中删除取消按钮所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)