我的应用程序仅在横向模式下运行。
我读到这个并说 UIImagePickerController 只加载纵向模式。
如何旋转应用程序以选择图像并再次返回横向模式。
我有这段代码,我的应用程序崩溃了。
- (IBAction)LoadImage:(id)sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate=self;
[picker setSourceType:(UIImagePickerControllerSourceTypePhotoLibrary)];
[self presentViewController:picker animated:YES completion:Nil];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self dismissViewControllerAnimated:NO completion:nil];
//.....
}
我试试这个但不工作......
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return (UIInterfaceOrientationMaskAll);
}
- (BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait);
}