解除ViewController后,我的视图仍保留在以前的视图控制器中';iOS7中的s方向
由于我使用的是iOS应用程序,因此仅支持纵向解除ViewController后,我的视图仍保留在以前的视图控制器中';iOS7中的s方向,ios,iphone,ios7,navigation,uiinterfaceorientation,Ios,Iphone,Ios7,Navigation,Uiinterfaceorientation,由于我使用的是iOS应用程序,因此仅支持纵向方向。 但我遇到了一些与定向有关的问题 我的应用程序只支持纵向 当我的父母P1.view使用导航推送时,处于纵向模式就可以了。现在从P1.view我正在子视图C1.view 现在我在childviewC1.view中,并从那里使用代理调用 -(无效)imagePickerController:(UIImagePickerController*)选择器 [self.delegate openCamera]//从C1.view调用 -(void)open
方向。
但我遇到了一些与定向有关的问题
- 我的应用程序只支持纵向
- 当我的父母P1.view使用导航推送时,处于纵向模式就可以了。现在从P1.view我正在子视图C1.view
- 现在我在childviewC1.view中,并从那里使用代理调用
-(无效)imagePickerController:(UIImagePickerController*)选择器
[self.delegate openCamera]
//从C1.view调用
-(void)openCamera //declared in P1.view
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;>
[self presentModalViewController:picker animated:YES];
}
- 现在,当我在Lanscape模式下拍摄照片并将其关闭时
presentModalViewController“我的视图”以Landscap模式而不是纵向模式显示
模式
这些方法在视图控制器(P1和C1)中定义,在modelview关闭时也会调用,但 我的viewcontroller保留在横向视图中,应该不可能发生
这段代码在iOS6中工作正常,但在iOS7中工作不正常我认为preferredInterfaceOrientationForPresentation
不应该返回位掩码。你可以试试:
-(UIInterfaceOrientation)首选交互方向进行演示{
返回UIInterfaceOrientationPortrait;
}
对于iOS 7,您应该使用-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)到interfaceOrientation持续时间:(NSTimeInterval)持续时间,但这在iOS 6中不起作用。
- (BOOL)shouldAutorotate {
return YES;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return (interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
- (NSUInteger)supportedInterfaceOrientations {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown);
}