iPhone событие, когда собирается вращаться? - PullRequest
0 голосов
/ 19 декабря 2010

В моем приложении я хотел бы выполнить некоторую обработку, прежде чем мой вид повернется. Есть ли событие, которое происходит непосредственно перед вращением?

Спасибо, Alan

Ответы [ 2 ]

1 голос
/ 19 декабря 2010

проверить эти методы UIViewController:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

// Notifies when rotation begins, reaches halfway point and ends.
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;


- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;

// Faster one-part variant, called from within a rotating animation block, for additional animations during rotation.
// A subclass may override this method, or the two-part variants below, but not both.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);

// Slower two-part variant, called from within a rotating animation block, for additional animations during rotation.
// A subclass may override these methods, or the one-part variant above, but not both.
- (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
- (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation; // The rotating header and footer views are offscreen.
- (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration; // A this point, our view orientation is set to the new orientation.

Наслаждайтесь

1 голос
/ 19 декабря 2010

В UIViewController есть ряд событий, которые запускаются во время ротации.Следующие два триггера перед вращением:

- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation

"Отправлено контроллеру вида непосредственно перед тем, как пользовательский интерфейс начинает вращаться."

- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

"Отправлено контроллеру представления перед выполнениемодношаговое вращение пользовательского интерфейса. "

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...