我有一个UIViewController,我想在加载视图时打开相机的UIImagePickerController。当视图加载时打开UIImagePickerController
答:我写了下面的: 编辑 - 我现在使用viewDidAppear
- (void)viewDidAppear:(BOOL)animated{
imagePicker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else{
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
[imagePicker setDelegate:self];
[self presentModalViewController:imagePicker animated:YES];
}
的问题是,用户拍摄快照或从文件夹中选择图像后 - 它不断加载UIImagePicker再次 - 我怎么才能让它只调用一次?
B.我想将相机显示在一个矩形内(可以是UIImage或UIView)而不是全屏,这样我就可以离开我的顶部导航栏。
我怎样才能达到上述目的?
不能与图像拾取做到这一点,你必须用相机作为输入设备创建捕获会话,并在自定义视图中显示它。HTTP ://www.musicalgeometry.com/?p = 1273 –
我不能做A或B? – Dejell
两种都有。对于“A”我建议你在viewDidAppear void wait_fence错误,并且使用图像选择器无法完成“B”。 –