2010-04-16 154 views

回答

9

取決於你想要做什麼,

實現some of these methods在活動視圖控制器類:

  • -willRotateToInterfaceOrientation:duration:
  • -willAnimateRotationToInterfaceOrientation:duration:
  • -didRotateFromInterfaceOrientation:

或者some of these methods y中我們的應用程序委託:

  • -application:willChangeStatusBarOrientation:duration:
  • -application:didChangeStatusBarOrientation:

還是聽some of these local notifications

  • UIApplicationWillChangeStatusBarFrameNotification
  • UIApplicationDidChangeStatusBarFrameNotification
  • UIApplicationWillChangeStatusBarOrientationNotification
  • UIApplicationDidChangeStatusBarOrientationNotification
5

您可以使用此:

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 

    [[NSNotificationCenter defaultCenter] addObserver:self 
     selector:@selector(yourMethod:) 
     name:@"UIDeviceOrientationDidChangeNotification" object:nil]; 
相關問題