lock a view to launch initially in landscape (ONLY landscape) objective-C - objective-c

I want to initially launch one of the View controllers in JUST landscape mode, while the other views and the whole app can work in both portrait and landscape. How can I do it in iOS 7? Thank you.

So your whole app may supports all orientations but one view controller needs to be landscape only.
You can easily stop your landscape view controller to rotate from landscape to portrait but when the app is in portrait already then it is difficult to force the deivce to rotate as this contradicts the iPhone manufacturers priciple.
In fact, it is not really difficult when you know the trick. See my answer to this similar question.
Force controllers to Change their orientation in Either Portrait or Landscape

Related

How to do a portrait and landscape OSX app

Hi I have to develop a Cocoa app for OSX with both orientations (landscape and portrait). My first idea is when the app finish launch to check the screen resolution to see if it is portrait or landscape and then show the landscape view or the portrait view. The views have the same elements, the only difference is the position of them. How do you think is the best way of accomplish this? Two views with two controllers? one controller with two views? Any advise would be appreciated
Thanks

Fake a landscape view in portrait only mode

I have seen a similar question on Android but my question targets iOS. My app is portrait only and I have set up a landscape view which I would like to add to my current view, but there is no autorotation, the user manually rotates the device.
I have tried doing this but when I add it as a subview the view it comes out like this:
So as you can see it adds it as if the view is in landscape mode, how can I modify this? Thanks!
Make the view 480 wide and 320 tall in Interface Builder. Then use:
-(void)viewDidLoad {
myLandscapeView.transform =CGAffineTransformMake(0,1,-1,0,-80,80);
[self.view addSubview:myLandscapeView];
}

xCode: setView always portrait though device in Landscape

I have encountered a problem developing an iPad app with xCode.
When I load a view into my rootViewController like this
[self setView:viewController.view];
The view is always displayed in Portrait even though the device is rotated to landscape.
I checked all options and tried changing the shouldAutoRotateToOrientation method and it seems to have nothing to do with it.
If I rotate the device to portrait and then back to landscape it works.
Does anybody know why this is happening?
Best regards,
Matteo
The problem was that I was nesting viewControllers which leads to bad behavior like rotation notifications not being sent to certain ViewControllers.

how to change mainwindow.xib's orientation to landscape? [duplicate]

I appreciate I'm probably missing something basic here, but...
My iPad app will only support landscape mode, and has a MainWindow.xib Window that I'd like to work on in landscape mode in XCode 4, however the pull-down menu to change this (Simulated Metrics -> Orientation) is always grayed out.
I notice that Views can be rotated just fine, it's only Windows that can't be rotated in XCode 4 using this setting.
Is there a workaround for this, or do I have to put a View on top of the MainWindow in order to rotate it?
I think it's because apps always starts up in portrait and then rotates to appropriate oriantations. From the UIViewController docs:
Note: At launch time, applications should always set up their
interface in a portrait orientation. After the
application:didFinishLaunchingWithOptions: method returns, the
application uses the view controller rotation mechanism described
above to rotate the views to the appropriate orientation prior to
showing the window.
So you'll need the UIViewController magic for the simulated metrics to make any sense. If you used the "Window-based application" template as a starting point for your project try the "View-based application" template instead.

iPad application always opens in portrait mode

The app uses a UISplitView and it always opens in portrait mode. If the iPad is held horizontally it will open in portrait mode and then rotate to landscape. I'd like it to just open up in landscape mode without needing to rotate. Any ideas>
In Info.plist, set UIInterfaceOrientation to UIInterfaceOrientationLandscapeRight (or Left). See the Information Property List Key Reference for more details including how to have different orientations for iPhone versus iPad.