-(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,检查相机所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)