【发布时间】:2009-10-27 05:06:33
【问题描述】:
我已经为此苦苦思索了几个小时。当视图加载相机胶卷时,我有一些示例代码(使用UINavigationController)。但是,当我尝试将相同的代码合并到具有tabBarController 的应用程序中时,我得到一个空白模式UIImagePickerController。我没有追查我做错了什么。
// bring up image picker
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
NSLog(@"UIImagePickerControllerSourceTypePhotoLibrary available");
UIImagePickerController *ipc = [[UIImagePickerController alloc] init];
ipc.delegate = self;
ipc.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
ipc.allowsEditing = YES;
[self.tabBarController presentModalViewController:ipc animated:YES];
[ipc release];
}
任何见解都将不胜感激。
【问题讨论】:
-
您的示例在
viewDidLoad中有此代码吗?它是在其导航控制器上调用presentModalViewController:animated:,还是在其自身上调用? (你知道示例代码有效吗?) -
根控制器会调用presentModalViewController:animated:,当模态视图的viewDidLoad方法有上述逻辑时。
标签: ios uitabbarcontroller uiimagepickercontroller