uiinterfaceorientation

In Swift, how to get the device orientation correctly right after it's launched?

左心房为你撑大大i 提交于 2020-06-08 07:42:19
问题 I use following code to see if the device is in landscape mode or not: UIDevice.currentDevice().orientation.isLandscape.boolValue It works BUT if I put my device in landscape mode before the app is launched, and after viewDidLoad , I call this line of code, it always returns false . If I use this instead: interfaceOrientation.isLandscape it returns true , which is correct, but the compiler is showing a warning that interfaceOrientation was deprecated in iOS 8.0 . What is the correct way to

In Swift, how to get the device orientation correctly right after it's launched?

你。 提交于 2020-06-08 07:42:07
问题 I use following code to see if the device is in landscape mode or not: UIDevice.currentDevice().orientation.isLandscape.boolValue It works BUT if I put my device in landscape mode before the app is launched, and after viewDidLoad , I call this line of code, it always returns false . If I use this instead: interfaceOrientation.isLandscape it returns true , which is correct, but the compiler is showing a warning that interfaceOrientation was deprecated in iOS 8.0 . What is the correct way to

iOS 6 rotation not working

喜欢而已 提交于 2020-01-30 08:54:11
问题 I have overridden my UINavigationController to implement these methods: -(BOOL)shouldAutorotate { return [[self.viewControllers lastObject] shouldAutorotate]; } -(NSUInteger)supportedInterfaceOrientations { return [[self.viewControllers lastObject] supportedInterfaceOrientations]; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation]; } Now from my first view, I modally present this

iOS part of viewcontroller goes black when orientation changes

偶尔善良 提交于 2020-01-24 16:40:54
问题 When I change viewcontroller orientation while it's loading on particular orientation, part of the screen goes blank at the bottom. Steps to reproduce: Have tableview(Not necessary I think. could be any view) in a view controller Push a new viewcontroller which also has a tableview(Not necessary I think. could be any view) during an action Rotate the screen from one orientation to Another(Portrait to landscape or landscape to portrait).now you will be able to see the dark part. Press back

IOS7/IOS8 Allow only portrait in view controller

微笑、不失礼 提交于 2020-01-21 09:15:53
问题 I am building an app for iPhone that will have only 1 landscape view, and so i want to block landscape for all other, i have tried this: -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } But it stills rotates 回答1: I will suggest to just make your app for portrait mode and then whenever you need the landscape mode then allow landscape mode. First, as previously suggested click on -> Project name -> General -> Deployment Info -> Only select Portrait for

Forcing landscape orientation on fullscreen MPMoviePlayerController prevents correct rotation when exiting fullscreen

邮差的信 提交于 2020-01-19 05:24:27
问题 I have an iPhone application (iOS6+) that supports all interface orientations. However, only landscape orientation should be supported when an MPMoviePlayerController is playing a video fullscreen. I found the following solution on Stack Overflow and it works. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerWillEnterFullscreenNotification:) name:MPMoviePlayerWillEnterFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self

iPad app to start in landscape mode

只愿长相守 提交于 2020-01-13 06:25:10
问题 I searched for other existing posts, but none of them satisfied my requirements. Here is the problem i face, My app supports both the Modes , landscape and portrait. But my first screen only supports Landscape , so the app must start in Landscape. I have set supported Orientation to all the 4 options I have set the Initial interface orientation to Landscape (left home button) In the view controller of the first screen i am defining the below -(BOOL)shouldAutorotateToInterfaceOrientation:

Multiple UIInterfaceOrientations app with iOS 6

坚强是说给别人听的谎言 提交于 2020-01-10 03:13:26
问题 I'm having a bad time trying to set the new UIInterfaceOrientations from iOS 6. Resuming my app: My app have a bunch of views; Almost every view should be shown on Portrait orientation; 2 of my views (the ones that play videos with MPMoviePlayerViewController ) should rotate to left, right and portrait orientations. My original idea was to set the app supported orientation to Portrait and than change (don't know how) the supported orientation from the video player views. What would be the

UIInterfaceOrientation always return Portrait in AppDelegate iPad?

让人想犯罪 __ 提交于 2020-01-03 20:14:19
问题 I want to show the Splash Screen in iPad application. Before that i want to get the current device orientation Landscape or Portrait mode. I have used, UIInterfaceOrientation orientation= [[UIApplication sharedApplication] statusBarOrientation]; if (orientation == UIInterfaceOrientationLandscapeRight || orientation == UIInterfaceOrientationLandscapeLeft) { splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)]; splachview.image=[UIImage imageNamed:@"Default-Landscape.png"]

How do I detect an iPad's interfaceRotation at the start?

£可爱£侵袭症+ 提交于 2020-01-03 10:44:10
问题 I'm having problems getting my iPad app to detect its interfaceOrientation in the first UIViewController I initialize (in code). In fact, if I trace for application.statusBarOrientation, that too returns 1 (UIInterfaceOrientationPortrait) even if I launched in landscape. If I trace self.interfaceOrientation in my first UIViewController, it remains 1 until it gets to viewWillDisappear... Which is unfortunately too late! Here's some code (even though there's not much to see): In my appDelegate