Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone/iPad rotation

How can I detect the start of a rotation and the end of the rotation on these devices?

EDIT: So after your answers, how can I detect the begining and ending of the orientation change.

like image 291
Infinite Possibilities Avatar asked Dec 13 '25 07:12

Infinite Possibilities


1 Answers

You can implement the following two methods in your UIViewController.

To detect a start of a rotation, implement willRotateToInterfaceOrientation:duration: and to detect the end implment didRotateFromInterfaceOrientation: .

i.e.

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
    NSLog(@"I am starting to rotate");
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    NSLog(@"I have finished rotating");
}
like image 66
deanWombourne Avatar answered Dec 15 '25 05:12

deanWombourne