Hackmodford
Hackmodford

Reputation: 3970

Device orientation will change instead of has changed

Is there any way I can perform code before the device orientation animation finishes?

Right now I'm adding myself as an observer to UIDeviceOrientationDidChangeNotification

However I need my code to finish before the change actually occurs not after.

Upvotes: 2

Views: 1453

Answers (2)

mshau
mshau

Reputation: 503

Try to change it in this method:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

Upvotes: 2

Ryan Poolos
Ryan Poolos

Reputation: 18551

Check the documentation :)

Responding to View Rotation Events –

willRotateToInterfaceOrientation:duration:

willAnimateRotationToInterfaceOrientation:duration:

didRotateFromInterfaceOrientation:

http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIViewController_Class/Reference/Reference.html

Upvotes: 4

Related Questions