TTThumbView/TTPhotoView no autorotation

纵然是瞬间 提交于 2019-12-06 03:52:00

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

Have you overridden your application's:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

and returned YES for the landscape orientations?

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

    }
}

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