When I'm making another window the key window the status bar does not rotate according to what the current key window's root view controller responds to should autorotate.
I created a sample project that clearly demonstrates what I'm talking about:
http://bit.ly/tFLodd
Just run the app in the simulator rotate the interface and press the switch button rotate rotate ... and switch ... etc.
Does anybody have any ideas how to fix this?
Thanks
Related
I need to present a UIViewController (ViewControllerTwo) that only supports ".landscape" orientations from another UIViewController (ViewControllerOne) that only supports ".portrait" orientation. If you check the .gif below, you will notice that when the transition occurs it shrinks the content of "ViewControllerOne" and when you dismiss "ViewControllerTwo" the same happens.
The reason why this happens is related to the change of safe areas, which in portrait are different from landscape and vice versa. But if we override supportedInterfaceOrientations of "ViewControllerOne" to just support ".portrait" it should not be informed of the safe area changes if these changes relate to an unsupported orientation right?
Is this a bug/limitation from iOS?
(NO) -> What is the right way to handle this scenario?
(YES) -> What workaround do you recommend to solve this issue in the meantime?
You can check the Example Project here: https://github.com/mantuness/ExampleProject
Check the GIF below:
I am developing an application that read pdf in landscape mode. I write the following code and its works fine. But my problem is I download pdf reder code from
https://github.com/brow/leaves and implement that code in my application, after that in project my LandScapeViewController's base class is LeavesViewController (if I use the baseclass is UIViewController then it is working fine). So when i push from viewController to LandScapeViewController it works properly. But at that time i rotate the view more then two times or in 360 degree then i go to back. Its not working properly. Means after landscapeviewcontroller it must transfer portraitView but it can't do this. I give my project. Please Help me.
I search lots of in SO but all solution is base class is UIViewController but i need the LeavesViewController
Before rotation My first view is
then click on Button and rotate the view in 360 degree, After rotation click on back button and it display view like
This is the my code == MyCode
I write that code from heare set Portrait Mode to Landscape
So I'm creating and showing a custom window in my iOS app because I'm writing a dynamic alert view that also functions like a growl/toast alert. It works AWESOMELY in ios6 (Hopefully I can open source this baby and you can all check it out)
But anyway, when I run this in ios5, the window that my alerts exist on doesn't seem to rotate with the device/simulator. No matter what, my custom window stays in portrait mode.
The UIWindow is just a UIView subclass, so there's no nice 'shouldRotate' delegate method.
I'm kinda stumped on why this is happening in ios5 but not 6. Any help would be GREATLY appreciated ^_^
My window has a rootviewcontroller, which I completely forgot about. I just needed to implement
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return YES;
}
To get it to work.
:-D
It's usually not recommended two use multiple instances of UIWindow in one iOS app. The only valid reason to do so is to support external screens. You should use a UIView instead, ideally managed by a UIViewController.
I assume, (since you didn't provide any code, I can only assume) the reason why your window doesn't 'rotate' is, that it's simply not getting any notifications about device rotation. Only the keyWindow receives them by default.
I would highly recommend to redesign your app to use a properly managed UIView instead. If you desperately don't want that for some reason, you would have to register your instance of UIWindow to receive the UIDeviceOrientationDidChangeNotification and then (in the handler) evaluate what the new orientation is and change the window's frame accordingly (plus maybe other things that need to be done in response to the orientation change)
I'm having trouble getting my app to rotate since switching to Xcode 4 and iOS 5. After tearing my hair out, I created a brand-new test project to see if I could get a bare-bones app to rotate.
I created the test project using the 'Empty Application' template. All I added to this template was a UINavigationController, with a UIViewController pushed onto it. There is a nib file for the UIViewController, with one label that says 'Hello'.
On the target Summary screen, I clicked in all the buttons for 'Supported Device Orientations'.
In the .m files for the Navigation and View controller code I changed shouldAutoRotate... to:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (YES);
}
The test project builds with no issues and runs perfectly. There's a navigation bar and friendly 'Hello' message, but the darn thing won't rotate!
Obviously, I am missing something pretty simple, but I can't figure out what it is. My suspicion has fallen on the .nib. Under 'Simulated Metrics', there is an attribute called Orientation. This is set to Portrait. The only other choice is 'Landscape'. If I change this setting to 'Landscape' the view in the .nib editor changes to landscape, but when I run the app, it runs in Portrait mode, and still refuses to rotate.
Hopefully, someone will get a big laugh out of my blunder and point out the goofy mistake I'm making. Please do!
in your RootViewController.m find the line
return (UIInterfaceOrientationIsPortrait( interface Orientation ) );
and you can replace this with whatever... like
return (UIInterfaceOrientationIsLandscape( interface Orientation ) );
I started out with the UISplitViewController template in Xcode 4, and added a UIImageView that covers the whole detailViewController.
When i run the project the image and views render correctly. If i rotate the device it also renders correct, but if i hit the PopoverButton while in portrait and then rotate the device the image is rendered above the rootView..
I've been trying to reproduce the bug you're experiencing, but without success. Could you provide information about how you add the image view and how you set its frame?
One possible solution that I can think of is setting:
self.view.clipsToBounds = YES;
in viewDidLoad of the detail view controller.
It would however be great if you could provide some code, so that I can reproduce the bug and tell you what's wrong.