所以我有一个UITableViewControler以纵向模式显示tableview .
一旦我旋转iPhone,我想在横向模式下呈现模态视图 .
在tableView我使用:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
并处理目前的模态视图:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration {
if((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft))
{
NSLog(@"Push page view");
PagingViewController *s = [[PagingViewController alloc] initWithNibName:@"PagingView" bundle:nil];
s.hidesBottomBarWhenPushed = YES;
[self presentModalViewController:s animated:YES];
[s release];
}
}
模态视图我有以下内容:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
并且为了解雇它自己的模态视图,我这样做:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
NSLog(@"Dismiss my self");
[self.parentViewController dismissModalViewControllerAnimated:YES];
}
}
一些如何工作两次 . 第三次将iPhone从纵向模式旋转到横向模式时,我收到了错误的访问错误 .
我无法弄清楚是什么给了我错误 . 有人关心一枪吗?