uiinterfaceorientation

Xcode: Getting warning “implicit conversion from enumeration type UIDeviceOrientation”

余生颓废 提交于 2019-11-26 12:59:32
问题 Full warning: Implicit conversion from enumeration type \'UIInterfaceOrientation\' to different enumeration type \'UIDeviceOrientation\' Getting it on the line: [self orientationChanged:interfaceOrientation]; This is the method: - (void)orientationChanged:(UIInterfaceOrientation)interfaceOrientation I can\'t really understand where this warning is coming from. 回答1: UIDeviceOrientation refers to the physical orientation of the device whereas UIInterfaceOrientation refers to the orientation of

Why can't I force landscape orientation when use UINavigationController?

廉价感情. 提交于 2019-11-26 11:28:16
问题 I find many question to force UIViewController to landscape as default: How to force a UIViewController to Portrait orientation in iOS 6 And try this: - (BOOL)shouldAutorotate { return YES; } -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationLandscapeLeft; } But when I use UIViewController inside UINavigationController, I can\'t force to landscape

How to change the device orientation programmatically in iOS 6

爷,独闯天下 提交于 2019-11-26 11:14:22
In iOS 5 we could change the device orientation programmatically like so: [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; But in iOS 6 setOrientation is deprecated, how may i change the device orientation programmatically in iOS 6 ? Here are my "five cents", tested on iOS7 with ARC [[UIDevice currentDevice] setValue: [NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"]; This doesnt generate "leak" warning as performSelector will. UIAlertView - with this code, when you open UIAlertView during view(will/Did)appear you will notice

iOS7 iPad Landscape only app, using UIImagePickerController

此生再无相见时 提交于 2019-11-26 10:28:20
问题 I believe this is a common issue and many answers don\'t work anymore, many just partial, if you are under iOS7 and your iPad app is Landscape only, but you want to use the UIImagePickerController with source UIImagePickerControllerSourceTypePhotoLibrary or UIImagePickerControllerSourceTypeCamera . How to set it right, so it\'s working 100%? And you don\'t get mixed orientations and avoid the error \"Supported orientations has no common orientation with the application, and shouldAutorotate

What is the “right” way to handle orientation changes in iOS 8?

廉价感情. 提交于 2019-11-26 10:07:10
问题 Can someone please tell me the \"right\" or \"best\" approach to working with portrait and landscape interface orientations in iOS 8? It seems that all the functions I want to use for that purpose are deprecated in iOS 8, and my research has turned up no clear, elegant alternative. Am I really supposed to look at the width and height to determine for myself if we are in portrait or landscape mode? For example, in my view controller, how should I implement the following pseudocode? if we are

iOS: Device orientation on load

北城以北 提交于 2019-11-26 09:21:36
问题 It seems that when my app loads, it does not know its current orientation: UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]; if (orientation == UIDeviceOrientationPortrait) { NSLog(@\"portrait\");// only works after a rotation, not on loading app } Once I rotate the device, I get a correct orientation, but when I load the app, without changing the orientation, it seems that using [[UIDevice currentDevice] orientation] doesn\'t know the current orientation. Is there

RootViewController animation transition, initial orientation is wrong

廉价感情. 提交于 2019-11-26 06:15:11
问题 So I followed this thread: RootViewController Switch Transition Animation to transit the window.rootViewController from A to B to C. Code looks like this: [UIView transitionWithView:self.window duration:0.5 options: UIViewAnimationOptionTransitionFlipFromLeft animations:^{ self.window.rootViewController = newViewController; } completion:nil]; The problem is my app shall only support landscape, but during the rootViewController transition, the new view controller appears in portrait mode than

How to change the device orientation programmatically in iOS 6

与世无争的帅哥 提交于 2019-11-26 03:31:28
问题 In iOS 5 we could change the device orientation programmatically like so: [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; But in iOS 6 setOrientation is deprecated, how may i change the device orientation programmatically in iOS 6 ? 回答1: Here are my "five cents", tested on iOS7 with ARC [[UIDevice currentDevice] setValue: [NSNumber numberWithInteger: UIInterfaceOrientationPortrait] forKey:@"orientation"]; This doesnt generate "leak" warning as performSelector

Is [UIScreen mainScreen].bounds.size becoming orientation-dependent in iOS8?

自闭症网瘾萝莉.ら 提交于 2019-11-26 00:18:52
问题 I ran the following code in both iOS 7 and iOS 8: UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight); NSLog(@\"Currently landscape: %@, width: %.2f, height: %.2f\", (landscape ? @\"Yes\" : @\"No\"), [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height); The following is the result from iOS 8: