iphone Programming Glossary: uideviceorientation
how do I detect the iPhone orientation before rotating http://stackoverflow.com/questions/1160620/how-do-i-detect-the-iphone-orientation-before-rotating rotating In my program I'm moving things based on rotation but I'm not rotating the entire view. I'm Using static UIDeviceOrientation previousOrientation UIDeviceOrientationPortrait void applicationDidFinishLaunching UIApplication application window addSubview.. based on rotation but I'm not rotating the entire view. I'm Using static UIDeviceOrientation previousOrientation UIDeviceOrientationPortrait void applicationDidFinishLaunching UIApplication application window addSubview viewController.view window makeKeyAndVisible.. window makeKeyAndVisible NSNotificationCenter defaultCenter addObserver self selector @selector didRotate name @ UIDeviceOrientationDidChangeNotification object nil void didRotate NSNotification notification UIDeviceOrientation orientation UIDevice currentDevice..
iOS7 / iOS6 Conditional Rotation Portrait / Landscape for different sections of App http://stackoverflow.com/questions/19041650/ios7-ios6-conditional-rotation-portrait-landscape-for-different-sections-of @interface NavigationController BOOL isOrientationPortrait @end @implementation NavigationController UIDeviceOrientation lastAccepted UIDeviceOrientation lastKnown void setLockedToPortait BOOL isLocked isOrientationPortrait isLocked UIDeviceOrientation.. BOOL isOrientationPortrait @end @implementation NavigationController UIDeviceOrientation lastAccepted UIDeviceOrientation lastKnown void setLockedToPortait BOOL isLocked isOrientationPortrait isLocked UIDeviceOrientation getCurrentOrientation.. lastAccepted UIDeviceOrientation lastKnown void setLockedToPortait BOOL isLocked isOrientationPortrait isLocked UIDeviceOrientation getCurrentOrientation UIDeviceOrientation orientate UIDevice currentDevice orientation if orientate 0 needed for simulator..
iPhone - allow landscape orientation on just one viewcontroller http://stackoverflow.com/questions/2144520/iphone-allow-landscape-orientation-on-just-one-viewcontroller NSNotificationCenter defaultCenter addObserver self selector @selector didRotate name UIDeviceOrientationDidChangeNotification object nil Then you can rotate your views when you detect the device rotation. void didRotate NSNotification.. nil Then you can rotate your views when you detect the device rotation. void didRotate NSNotification notification UIDeviceOrientation orientation notification object orientation if orientation UIDeviceOrientationLandscapeLeft xxxView setTransform CGAffineTransformMakeRotation.. didRotate NSNotification notification UIDeviceOrientation orientation notification object orientation if orientation UIDeviceOrientationLandscapeLeft xxxView setTransform CGAffineTransformMakeRotation M_PI 2.0 else if orientation UIDeviceOrientationLandscapeRight..
Disabling autorotate for a single UIView http://stackoverflow.com/questions/2191522/disabling-autorotate-for-a-single-uiview to rotate it yourself NSNotificationCenter defaultCenter addObserver self selector @selector didRotate name UIDeviceOrientationDidChangeNotification object nil And in didRotate you do the resize with a nice animated transition if you like. void didRotate.. you do the resize with a nice animated transition if you like. void didRotate NSNotification notification int ori 1 UIDeviceOrientation currOri UIDevice currentDevice orientation if currOri UIDeviceOrientationLandscapeLeft currOri UIDeviceOrientationLandscapeRight.. NSNotification notification int ori 1 UIDeviceOrientation currOri UIDevice currentDevice orientation if currOri UIDeviceOrientationLandscapeLeft currOri UIDeviceOrientationLandscapeRight ori 0 Hope that sorts you. If Navigation bars or status bars cause..
Detecting rotation to landscape manually http://stackoverflow.com/questions/3005389/detecting-rotation-to-landscape-manually this listener in the viewDidLoad NSNotificationCenter defaultCenter addObserver self selector @selector didRotate name UIDeviceOrientationDidChangeNotification object nil the didRotate looks like this void didRotate NSNotification notification UIDeviceOrientation.. object nil the didRotate looks like this void didRotate NSNotification notification UIDeviceOrientation orientation UIDevice currentDevice orientation if orientation UIDeviceOrientationLandscapeLeft your code here iphone.. NSNotification notification UIDeviceOrientation orientation UIDevice currentDevice orientation if orientation UIDeviceOrientationLandscapeLeft your code here iphone rotation device share improve this question I needed that in an old project hope..
unrecognized selector sent to instance http://stackoverflow.com/questions/5637203/unrecognized-selector-sent-to-instance orientation viewcontrollers. @implementation MainViewController void orientationChanged NSNotification notification UIDeviceOrientation deviceOrientation UIDevice currentDevice .orientation if UIDeviceOrientationIsLandscape deviceOrientation isShowingLandscapeView.. NSNotification notification UIDeviceOrientation deviceOrientation UIDevice currentDevice .orientation if UIDeviceOrientationIsLandscape deviceOrientation isShowingLandscapeView self presentModalViewController self.landscapeViewController animated.. self presentModalViewController self.landscapeViewController animated YES isShowingLandscapeView YES else if UIDeviceOrientationIsPortrait deviceOrientation isShowingLandscapeView self dismissModalViewControllerAnimated YES isShowingLandscapeView NO..
UIView addsubview after orientation change: Tell view to resize http://stackoverflow.com/questions/5995617/uiview-addsubview-after-orientation-change-tell-view-to-resize 0 self.view addSubview inputView self.view setNeedsLayout self.view layoutSubviews self.view layoutIfNeeded UIDeviceOrientation orientation UIDevice currentDevice orientation self shouldAutorotateToInterfaceOrientation orientation Unfortunately there..
Rotating an image 90 degrees on same position when orientation changes http://stackoverflow.com/questions/6404786/rotating-an-image-90-degrees-on-same-position-when-orientation-changes creates a rotation transform and applies it to all outlets. void deviceDidRotate NSNotification notification UIDeviceOrientation currentOrientation UIDevice currentDevice orientation double rotation 0 UIInterfaceOrientation statusBarOrientation switch.. currentDevice orientation double rotation 0 UIInterfaceOrientation statusBarOrientation switch currentOrientation case UIDeviceOrientationFaceDown case UIDeviceOrientationFaceUp case UIDeviceOrientationUnknown return case UIDeviceOrientationPortrait rotation.. rotation 0 UIInterfaceOrientation statusBarOrientation switch currentOrientation case UIDeviceOrientationFaceDown case UIDeviceOrientationFaceUp case UIDeviceOrientationUnknown return case UIDeviceOrientationPortrait rotation 0 statusBarOrientation UIInterfaceOrientationPortrait..
Storyboards orientation support for xCode 4.2? http://stackoverflow.com/questions/7803524/storyboards-orientation-support-for-xcode-4-2 2.Look for notifications NSNotificationCenter defaultCenter addObserverForName UIDeviceOrientationDidChangeNotification object nil queue nil usingBlock ^ NSNotification note We must add a delay here otherwise we'll swap.. isShowingLandscapeView is declared in AppDelegate so you won't need to declare it in each ViewController UIDeviceOrientation deviceOrientation UIDevice currentDevice .orientation if UIDeviceOrientationIsLandscape deviceOrientation appDelegate .isShowingLandscapeView.. need to declare it in each ViewController UIDeviceOrientation deviceOrientation UIDevice currentDevice .orientation if UIDeviceOrientationIsLandscape deviceOrientation appDelegate .isShowingLandscapeView UIStoryboard storyboard UIStoryboard storyboardWithName..
|