在我的应用程序中,我尝试使用TTphotoView,因此在ViewController中我用我的navigationController推送TTphotoView,如下所示:
if(self.photoViewController == nil {
PhotoViewController *viewController = [[PhotoViewController alloc] init];
self.photoViewController = viewController;
viewController.hidesBottomBarWhenPushed = YES;
[viewController release];
}
[self.navigationController pushViewController:self.photoViewController animated:YES];
[self.navigationController dismissModalViewControllerAnimated:YES]
问题是当用户在PhotoViewController上旋转设备时没有任何事情发生。
编辑:我无法相信人们没有同样的问题。如果有人在他的应用程序中使用他自己的导航而不是TTNavigation,他可以告诉我他是如何推动ViewController的吗?答案 0 :(得分:2)
我遇到了同样的问题。
我不知道为什么但是三个20代码中的TTScrollView deviceOrientationDidChange方法被注释掉了!如果您取消注释,它将起作用。
请参阅此处的代码:http://github.com/facebook/three20/blob/master/src/TTScrollView.m
答案 1 :(得分:0)
您是否覆盖了您的应用程序:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
并为横向方向返回YES?
答案 2 :(得分:0)
我对 willcodejavaforfood 的评论,正如我告诉你的那样,我可以通过做一些事情来强迫,但内部有太多的问题,而且三个20的PhotoViewController必须自己做,所以我不这样做希望如此:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
}
-(void) receivedRotate: (NSNotification *) notification {
NSLog(@"ORIENTATION CHANGE");
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
if(interfaceOrientation == UIDeviceOrientationLandscapeRight) {
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration: 0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
self.view.transform = CGAffineTransformIdentity;
self.view.transform = CGAffineTransformMakeRotation(-M_PI/2);
self.view.bounds = CGRectMake(0.0, 0.0, 480.0, 320.0);
self.view.center = CGPointMake(240.0f, 160.0f);
[UIView commitAnimations];
}
}