iphone – UIImagePickerController,检查相机

iphone – UIImagePickerController,检查相机,第1张

概述-(void)viewDidLoad{ if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { imagePicker = [[UIImagePickerController alloc] init]; imagePicker
-(voID)vIEwDIDLoad{    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])   {      imagePicker = [[UIImagePickerController alloc] init];      imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;      imagePicker.showsCameraControls = NO;      [self.vIEw addSubvIEw:imagePicker.vIEw];      }      else      {      // UIAlertVIEw…      }}    -(voID)vIEwDIDAppear:(BOol)animated    {        [super vIEwDIDAppear:animated];        imagePicker.delegate = self;        [self presentVIEwController:imagePicker animated:NO completion:NO];    }

我想在你没有相机的时候发出警报.
iPhone应用程序启动并移动此代码.
但是,崩溃(此错误>

返回UIApplicationMain(argc,argv,nil,NsstringFromClass([CameraAppDelegate class])); >线程1:信号SIGABRT)在模拟器中运行.

为什么是这样?

解决方法 使用此代码并在.h文件中添加UIImagePickerControllerDelegate委托

if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])      {       UIImagePickerController* picker = [[UIImagePickerController alloc] init];       picker.sourceType = UIImagePickerControllerSourceTypeCamera;       picker.delegate = self;      picker.wantsFullScreenLayout = YES;      [self presentModalVIEwController:picker animated:YES];    }    else    {        UIAlertVIEw *altnot=[[UIAlertVIEw alloc]initWithTitle:@"Camera Not Available" message:@"Camera Not Available" delegate:self cancelbuttonTitle:@"OK" otherbuttonTitles:nil,nil];        altnot.tag=103;        [altnot show];        [altnot release];    }
总结

以上是内存溢出为你收集整理的iphone – UIImagePickerController,检查相机全部内容,希望文章能够帮你解决iphone – UIImagePickerController,检查相机所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1052835.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存