Unable to rotate Interface Orientation issue in iOS 6 - iphone

I have a app which i want to display in portrait mode. But I only want to show one view in both modes.
I have do this for iOS5 . But in iOS6,i can't able to do this.
I also tried many codes to solved it.
How can I solve this problem?

apple has changed orientation in ios 6 .
in short use following steps:
1) set supported orientations in Targets->Summary...
2)In iOS6.0 shouldAutorotateToInterfaceOrientation Method is
deprecated.So,instead of this method we have to use shouldAutorotate
Method.
- (BOOL)shouldAutorotate
{
return NO;
}
3) in method supportedInterfaceOrientations we have to set which
orientations we want like UIInterfaceOrientationMaskAll if we want
all orientations
- (NSUInteger)supportedInterfaceOrientations
{
return (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown );
}

Related

view does not rotate when orientation is upsidesidedown in ios 7

I tring to make app support all orientation. Its working fine but only upside down orientation is not working. I am using ios7. For upside down the view does not rotate. I tried following code
-(BOOL)shouldAutorotate
{
return yes;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll; // etc
}
My only second method is called but not first method. In infoPlist I enabled all the supported orientations.
Found the fix. Sourced mainly from: https://stackoverflow.com/a/12758715/394969
In a nutshell for people who land here first:
/* In your view controller */
// Add support for upside down
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
Also flip on all device orientations in project settings as outlined in #Jignesh Mayani's answer. If that doesn't immediatley fix your issue check the link above for how to work with nav controllers and tab controllers (they all must support the required interface orientations).
Confirm that you have check, Go your project setting and Check

rotation issue in ios 6

I've looked everywhere, Yet I cant find a solution for this annoying rotation issue in iOS 6.
for some reason, I cant get the rotation methods in iOS 6 to work. they are not even called.
for example:
if I want to keep a view in portrait mode in iOS 5, I use:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
I learned that the new method in iOS 6 should be:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
I've also try to add:
-(BOOL)shouldAutorotate
{
return NO;
}
but it dosent work at all.
please help!
If you have all that it should be as simple as setting the supported orientations in the Info.plist as well as in your controllers. You can do this through the Summary tab on your project target.

ios : MPMoviePlayerViewController all orientation support for the entire portrait app

Entire app is supports only portrait orientation, only playing a video needs to support all the orientations.
The application is running perfectly on iOS < 6.0 in entirely portrait mode, now as the requirement need to support auto-rotation orientation for the MPMoviePlayerViewController (video to play) for iOS 6.0 as well, I've searched many things around, and I got below solutions so I've applied those in my app,
1) Support all the orientations in plist or in targets
2) add the below orientation functions for portrait support
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (BOOL)shouldAutorotate
{
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}
3) Override MPMoviePlayerViewController class, and added all suitable orientation methods to support.
4) Put below method in AppDelegate file, and return landscape if you find an object of MPMoviePlayerViewController.
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { }
but at last, there's no success! - I can't play video in landscape mode, only portrait is supporting in entire app.
I don't know why its not rotating? Is there something that I'm missing to set?
I recently had to do the opposite in an app I developed, where I had to force video-playback to appear only in landscape mode. What I did was to let my app support all orientations, and instead override my mpMoviePlayerViews shouldAutorotateToInterfaceOrientation method to return YES only for landscape.
Since you want to do the opposite, how about allowing both potrait and landscape for your app - but limiting your regular views to only potrait? (and thus avoiding your problems to allow rotation for your mpmovieplayerview) I think it should be possible to create a parent (view) class that your regular views could inherit from, and in your parent class just override shouldAutorotateToInterfaceOrientation to only support/return YES for potrait mode.

What are the changes in ios 6 as compare to previous versions of xcode?

I was build an app in ios 4.1 but now i am using ios 6 to build it but there are problems in pushviewcontroller and orientation methods. So can any one tell me what are the changes have brought in ios 6?
I think that best solution is to stick to official apple documentation. So according to that I use following methods and everything is working very well on iOS 5 and 6. In all of your ViewControllers override following methods.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
Methods for iOS 6, first method returns supported orientation mask (as their name indicate), you can change it into Landscape or what suites you best.
-(NSInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait; //UIInterfaceOrientationMaskPortrait or LandscapeLeft ...
}
second one thats tells your VC which is preferred interface orientation when VC is going to be displayed.
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationPortrait; //tells your VC in which orientation it should be presented, if you set Porttrait it would be in Portrait or otherwise ...
}
This solution is working

iOS how to stop view rotate

I want my iPad app to stop rotation as you rotate the iPad. I want to stop rotate every view.
Any ideas help?
if you want stop rotation for whole app then simply in app info.plist file changed Supported interface orientations ,Initial interface orientation property to portrait or landscape depends on you
In iOS6 shouldAutorotateToInterfaceOrientation has be deprecated. Override both supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation instead.
Please see
Just check the auto-resizing property of your view controller.
(Fixed syntax error)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
return NO;
}
In My Project's info.plist I have deleted some key on the iPad Supported interface orientations like the following image (I have only given support for the portrait orientation)
The main idea of global controllable rotation lock is to write UIViewController category containing lock mechanism for every view controller.
You simply need to modify supportedInterfaceOrientations method globally
- (NSUInteger)supportedInterfaceOrientations
{
return __orientation;
}
Here __orientation is the static variable which can be set via category method.
The full realization of the category is presented here
Please update your projectname.plist like this. Supported interface orientations have only one object "Portrait (bottom home button)"
I strongly advise against stop rotation on iPad because supporting rotation is a must on the iPad. This is because the iPad does not have a normal way in which it will be held unlike the iPhone, which is normally held in portrait view (AKA Vertical). So you have to leave the choice to the user to eventually lock the orientation
The HIG do not actually state this as a requirement, but as a recommendation but there are many app that was rejected by this issue.
By the way if you want to this for a limit number of view controller you should implement:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationPortrait){
return YES;
}
}