views:

926

answers:

3

Hi,

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?

A: 

Have you overridden your application's:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

and returned YES for the landscape orientations?

willcodejavaforfood
yes I already do it. My UiNavigationcontroller or UITbabBarController can be a problem or not?
ludo
So PhotoViewController does override shouldAutoRotateToInterfaceOrientation? If it does I don't think the parent view should need to.
willcodejavaforfood
Yes maybe it override it but I'm not sure. I really don't know what can be the problem. I can force the rotation I will show you in my 2nd answer but I don't want to do this because there will be too much problem with everything inside.
ludo
I'm sorry but I'm not sure then. I would have to see all the code almost I think.
willcodejavaforfood
A: 

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

    }
}

ludo
+1  A: 

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

Koray Balci
I will have to look at it because I don't think in my code it was in comment. But my problem was with the TabBar, I needed to allow the TabBar to rotate in my application and now its working
ludo