的选项卡时,只能旋转的一些看法这里是我无法弄清楚如何工作的流程。 (当我声明(工作)时,这意味着在当前状态下,该视图的方向规则正常工作)我如何与一个UINavigationController工作作为一个的UITabBarController
第一次查看:UITabBarController的选项卡的UINavigationController的堆栈上的TableView。
TableView只允许为肖像。 (working) 当您将TableView旋转到横向模式时,会出现一个类似于coverflow的自定义UIView(我将在稍后解释该问题)。
甲选择上的tableview由上推到堆栈一个UIScrollView。
UIScrollView的是允许所有方向。 (工作)
当UIScrollView的是在横向模式和用户打回他们被带到了自定义的UIView是喜欢的CoverFlow和只允许景观。
问题在这里。由于UIScrollView允许完整旋转,因此它允许TableView旋转以及横向旋转。
我有一个方法附加到通知“UIDeviceOrientationDidChangeNotification”,检查自定义视图是否是当前控制器,如果是,并且用户已经旋转回肖像我需要弹出自定义视图并显示表视图。
表视图有转回肖像,这确实是好的,只要用户不会看到它。当我创建自定义动画时,除了一些奇怪的看不见的黑盒子,它似乎随着设备旋转之前,我淡出自定义视图到桌面视图非常好。
此外,为了确保我的tableview将旋转到纵向,我必须允许customview支持所有方向,因为系统查看当前视图(在我的代码中)是否允许该应用旋转到一定的方向。正因为如此,我提出的许多解决方案将在桌面视图重新聚焦时显示自定义视图旋转到纵向。
我的其他问题非常相似。如果您正在查看tableview并旋转customview的模态视图。在此视图上进行选择时,它会将UIScrollview推入堆栈,但由于Tableview仅支持纵向,所以在设备处于横向模式时,UIScrollview以纵向显示。
我该如何克服这些可怕的块?
这是我目前的尝试:
当谈到与工作的UITabBarController系统真的只关心什么tabbarcontroller不得不说的旋转。
目前无论何时报告一个视图加载它支持的方向。
TabBarController.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
switch (self.supportedOrientation) {
case SupportPortraitOrientation:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
return (interfaceOrientation == UIInterfaceOrientationPortrait);
break;
case SupportPortraitUpsideDownOrientation:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
return (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
break;
case SupportPortraitAllOrientation:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
break;
case SupportLandscapeLeftOrientation:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
break;
case SupportLandscapeRightOrienation:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
break;
case SupportLandscapeAllOrientation:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
break;
case SupportAllOrientation:
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];
}else {
//[[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES];
}
return YES;
break;
default:
return (interfaceOrientation == UIInterfaceOrientationPortrait);
break;
}
}
的代码块是我的UINavigationController的一部分,并且是在响应该通知UIDeviceOrientationDidChangeNotification的方法。它负责弹出customview并显示tableview。有两种不同的版本,最初是针对两种不同版本的SDK,但两者都非常接近解决方案。
第一个在3.0上不支持的原因是由于某些原因,您无法将视图显示并显示为模式视图。不知道这是一个错误还是一个功能。
第二种解决方案工作得非常好,除了我看到一个围绕iphone旋转的外框。
if ([[self topViewController] isKindOfClass:FlowViewController.class]) {
NSString *iphoneVersion = [[UIDevice currentDevice] systemVersion];
double version = [iphoneVersion doubleValue];
if(version > 3.0){ //1st solution
//if the delivered app is not built with the 3.1 SDK I don't think this will happen anyway
//we need to test this
[self presentModalViewController:self.flowViewController animated:NO];
//[self toInterfaceOrientation:UIDeviceOrientationPortrait animated:NO];
[self popViewControllerAnimated:NO];
[self setNavigationBarHidden:NO animated:NO];
[self dismissModalViewControllerAnimated:YES];
}else{ //2nd solution
DLog(@"3.0!!");
//[self toInterfaceOrientation:UIDeviceOrientationPortrait animated:NO];
CATransition *transition = [CATransition animation];
transition.duration = 0.50;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFade;
CATransition *tabBarControllerLayer = [CATransition animation];
tabBarControllerLayer.duration = 0.50;
tabBarControllerLayer.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
tabBarControllerLayer.type = kCATransitionPush;
tabBarControllerLayer.subtype = kCATransitionFade;
[self.tabBarController.view.layer addAnimation:transition forKey:kCATransition];
[self.view.layer addAnimation:transition forKey:kCATransition];
[self popViewControllerAnimated:NO];
[self setNavigationBarHidden:NO animated:NO];
}
[self performSelector:@selector(resetFlow) withObject:nil afterDelay:0.75];
}
我接近确信没有解决方案,除了手动旋转,这弄乱了键盘旋转。
任何意见将不胜感激!
谢谢。