TTThumbView / TTPhotoView no autorotation

In my application, I am trying to use TTphotoView, so in ViewController, I click TTphotoView using my navigation controller as follows:



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 that the user rotates the device on the PhotoViewController, nothing happens.

EDIT: I cannot believe that people did not have the same problem. If someone uses photoView in their application with their own navigation and not TTNavigation, can he tell me how he clicked ViewController?

+3
source share
3 answers

I had the same problem.

, , TTScrollView deviceOrientationDidChange tr20 ! , .

: http://github.com/facebook/three20/blob/master/src/TTScrollView.m

+2

:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

YES ?

0

My comment is for willcodejavaforfood , since I told you that I can make it do something like, for example, but there are too many problems inside, and the PhotoViewController of three20 must do it myself, so I don’t want to:



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

    }
}

0
source

Source: https://habr.com/ru/post/1732465/


All Articles