SLComposeViewController auto rotation - ios7

I have a UIViewController which is always in landscape orientation. I present an instance of SLComposeViewController but to my surprise this results in autorotation of both my view controller to portrait mode along with my instance of SLComposeViewController. How do I stop this autorotation from happening ? Is SLComposeViewController only supported in portrait mode ?

Instead of rewriting an existing post, I will give you a link to another post that has the code. Take a look at this post. The individual did a good work on explaining it as well.
Please view the second anwser by klkl

Related

Presented View Controller Has Wrong Frame When Orientation Changes

I have a custom UINavigationController (only customized to standardize colors and a few other things) that I use throughout my iPhone app. When I rotate my phone, everything works fine. Unfortunately, when I use said controller with presentViewController, things get weird after rotating.
Do I have to do anything special with a view controller that is presented to make it play well with orientation changes?
Something similar happened with my app.
I was presenting the view controller from a ChildViewController. I changed the presenting view controller to the parentViewController instead of the childViewController, and it worked properly.
I hope this help you!
Regards,
Martin.

Application Lauch in Landscape mode while Simulator/Device is in Portrait mode in ios6

My application window has UITabBarController as a RootViewController. Then UINavigationController as TabBarController's RootViewController. Then another HomeViewController as NavigationController's RootViewController.
When I launch my application in Portrait mode, then HomeViewController's UIView outlets displayed in Landscape mode. All UIView outlets have Landscape mode coordinate. Because return Orientation is Landscape.
I found many Q&A, Blogs. I applied whatever other developers said, but not succeed.
This issue occurs only in ios6 device/iPhone simulator 6.
Right now I am working on Simulator and its show this issue.
Please help me as soon as possible.
Ask me, if I am not capable to explain my question.
Thank you in advance.
In iOS 6, the app looks at your predefined possible orientations from your project file. Check if that only lists landscape, also it uses the shouldAutoRotate method, so you might have to implement that as well.
Check this for more info:
Similar question

iOS6 rotate methods not called when launching in landscape

Let me start off by saying I'm not having a problem when rotating views in iOS6 after the app is open. This issue is only happening for me when the app is launched for the first time while in landscape. The new shouldAutorotate and supportedInterfaceOrientations methods are both called when launched, however none of the rotation methods are called, like willRotateToInterfaceOrientation:duration:. (shouldAutorotate is always returning YES, and supportedInterfaceOrientations is always returning UIInterfaceOrientationMaskAll)
In iOS5, the 'first' orientation to landscape on launch was taken care of automatically. Is there an explanation for why the device wouldn't call this first landscape rotation in iOS6? (The view controller I'm checking is the root controller of the window/app delegate).
Thanks in advance for any help with and insight into this.
I suppose that since the interface is not actually rotating, that the method isn't being called.
If you want to do some setup based on the orientation, have you thought of using the view controller's intefaceOrientation property?
You should now use the viewWillLayoutSubviews method and not willRotateToInterfaceOrientation:duration:. The reason is because willRotateToInterfaceOrientation:duration: is not guaranteed to be called in a number of situations.
This is stated in the iOS6 release notes among other places.

Hide MasterView in UISplitViewController

UPDATE
I ended up fixing the issues with MGSplitViewController, so I am now using this fork of the project: http://github.com/ArtSabintsev/MGSplitViewController At the time of writing this edit, the fork hasn't been pulled into Matt Gemmell's master branch.
Please Note
My iPad app is Landscape only, and is iOS5 and iOS6 compatible
I have a partially working solution, but I need to take it one step further.
For the majority of the screens in my app, I need to present both the master and detail views (normal behavior).
At one point, I need to only the detailVC to be present.
How am I doing it now?
I am using the following UISpliterViewControllerDelegate Method
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return self.hideRootViewController;
}
where hideRootViewController is a boolean that is set to NO initially.
The Partial Solution
If I change the boolean to YES (in any screen/VC in my app) and rotate the screen, the masterVC disappears, and the detailVC occupies the entire screen.
The Remaining Problem
How do I force this change without physically having to rotate the device, or how do I force a device orientation notification change to redraw UISplitViewController?
The following attempts have failed:
CGAffineTansformation (Identity and small angle transformations)
Posting a UIDeviceOrientationDidChangeNotification
Calling setNeedsLayout on splitVC.view
Presenting and immediately dismissing modalVC's on splitVC
Note: I am not using MGSplitViewController, nor do I want to use that class in this project.
To manually force a rotation, you can use:
[[UIApplication sharedApplication] setStatusBarOrientation:]
Why dont you use mgsplitviewcontroller. I used it in my project, it works wonderful and very easy implement. You can able hide/switch master view easily.

Disabling buttons before view rotates

So been working on another app recently for iOS which incorporates a UIImagePickerViewController. App is ready to go and all works fine under normal circumstances, but if the user is being eratic and pushing buttons whilst rotating the iPad, then things go slightly awry and views load in the wrong place.
So basically, I want to disable all my buttons before the iPad is rotated and enable them again after the view is done rotating.
I thought this would be easy using the
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
and
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
methods.
But because the UIImagePickerController is being displayed, this for some reason stops these methods from being called. So I can't use these methods.
So basically, what I'm asking is if anybody can think of any other ways that I could achieve this??
Thanks,
Matt
You could subclass UIImagePickerController and then implement those methods on your UIImagePickerController subclass.