TTThumbView/TTPhotoView no autorotation

*爱你&永不变心* 提交于 2019-12-07 18:09:07

问题


In my app I try to use the TTphotoView, so in a ViewController I push the TTphotoView with my navigationController like this:



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]


the problem is when the user rotate the device on the PhotoViewController nothing happen.

EDIT : I can't believe people didn't have the same problem. If someone use the photoView in his application with his own navigation and not the TTNavigation can he tell me how did he push the ViewController?


回答1:


I had the same problem.

I don't know why but TTScrollView deviceOrientationDidChange method in three20 code is commented out! If you uncomment it, it will work.

See the code here: http://github.com/facebook/three20/blob/master/src/TTScrollView.m




回答2:


Have you overridden your application's:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

and returned YES for the landscape orientations?




回答3:


My comment for willcodejavaforfood, as I told you I can force by doing something like for example that but too many problem inside, and the PhotoViewController of three20 must do it by himself so I don't want that:



- (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];

    }
}



来源:https://stackoverflow.com/questions/2249663/ttthumbview-ttphotoview-no-autorotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!