I'd like to know the new width my UIViewControllers
view will have after a rotation change, but I need this information already in the
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
method, so I can not access the frame or bounds property.
I tried using the layer properties presentationLayer
and modelLayer
, but did not found the correct solution.
Would be great if somebody know the solution or can give some food of thought.
I found the problem!
The method I used was called to early:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
Instead I know use this:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
CGRect frame = [self.view.window convertRect:self.view.frame fromView:self.view];
float newWidth = frame.size.width;
// Doing my animation stuff...
}
This allows me to have the correct new width and animate my views properly.