当我尝试从相机胶卷中选择图像时,我收到以下警告。 (当我按下按钮相机滚动时,它会选择相册页面,我们可以从手机中选择图像。)
在分离的视图控制器上呈现视图控制器是 泄气
我的didFinishLaunchingWithOptions
方法是这样的:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarHidden:YES];
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault synchronize];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
navigation.navigationBarHidden = YES;
[self.window makeKeyAndVisible];
}
我的相机按钮代码是:
- (void)cameraButtonSelected
{
ELCAlbumPickerController *albumController = [[ELCAlbumPickerController alloc] initWithNibName:nil bundle:nil];
ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initWithRootViewController:albumController];
[albumController setParent:elcPicker];
[elcPicker setDelegate:self];
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[app.viewController presentViewController:elcPicker animated:YES completion:nil];
[self.view.window.rootViewController.navigationController pushViewController:elcPicker animated:YES];
}
答案 0 :(得分:0)
在ViewController或ViewDidAppear方法中编写相机方法。
答案 1 :(得分:0)
在这里,您尝试同时展示picker
以及推送。
推动你的选择器或呈现它。
如果您在场或从任何视图控制器推送它,那么只需写下:
无论
[self presentViewController:elcPicker animated:YES completion:nil];
或者
[self.navigationController pushViewController:elcPicker animated:YES];