![](/img/trans.png)
[英]iPad iOS7 - UIImagePickerController in UIPopoverController has wrong preview image
[英]UIImagePickerController with UIPopOverController, iPad ios 6
我正在嘗試從iPad應用程序訪問照片庫。 據說“在iPad上,必須通過UIPopoverController呈現UIImagePickerController”。 那也正是我得到的日志消息。
這是我的應用程序的快照:
由於我已經通過彈出窗口列出了選項,因此從內部進行另一個彈出窗口沒有任何意義。 當用戶點擊“照片庫”單元格時,將調用accessPhotoLibrary方法。
-(void)accessPhotoLibrary{
NSLog(@"Photo library access requested!");
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]){
NSLog(@"Photo Library");
[imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePickerController setDelegate:self];
[imagePickerController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:imagePickerController animated:YES completion:nil];
}
else{
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: @"Photo Library"
message: @"Sorry, couldn't open your photos library"
delegate: nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
但是,如果我已經使用過一個彈出窗口,該如何解決必須使用彈出窗口訪問照片庫的問題呢?
任何幫助深表感謝。
您可以在同一彈出窗口中顯示圖像選擇器。 保留對彈出框的引用(顯示彈出框的父視圖控制器可以傳遞引用),然后可以執行以下操作:
[_parentPopover setContentViewController:imagePickerController animated:YES];
如果需要,可以使用圖像選擇器視圖控制器中的屬性“ contentSizeForViewInPopover”來更改彈出窗口中顯示的內容的大小。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.