我有一個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」。 –