我有2個故事板iPhone和iPad。 從UITableviewcontroller上的按鈕我想用UIImagepicker選擇一個圖像。UIImagepicker立即消失iPhone上顯示
在iPad上,這個工作正常,在iPhone上,UIImagepicker顯示的時間很短,然後他消失了。
調用代碼與iPhone上的iPad相同,因爲我可以看到故事板是idenitical。我在尋找幾個小時,並且看不清爲什麼Imagepicker在iPhone和iPad上消失。 有沒有人有這種行爲的想法? UIImagePicker沒有做任何事情就會消失的原因是什麼?
- (void) go {
UIImagePickerController *ipc = [[UIImagePickerController alloc]init];
[ipc setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
ipc.delegate=self;
[self presentViewController:ipc animated:YES completion:^{}];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
NSLog(@"imagePickerControllerDidCancel");
[self dismissViewControllerAnimated:YES completion:^{}];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self.navigationController dismissViewControllerAnimated:NO completion:^{}];
[self dismissViewControllerAnimated:NO completion:^{}];
NSLog(@"didFinishPickingMediaWithInfo");
}
在iPhone上,日誌「imagePickerControllerDidCancel」從不顯示!
顯示一些代碼!你是否已經加入了調試器,並且/或者取出了其他代碼,以查看是否可以最小化問題? –
聲明這個'UIImagePickerController * ipc'屬性,而不是局部變量 –