Edits to app delegate to lock in portrait ios 5 and 6 - objective-c

I'm having a few issues with stopping rotation in both ios 5 and ios 6. I want to lock the app into portrait. I'm using a nav bar based application, but the nav bars on some pages are hidden (if that makes a difference).
I'm not quite sure what edits to make in the app delegate, to disable autorotation and lock it into portrait to target these versions of iOs, any ideas?

Have you checked .info plist file?,if not then see supported inteface orientation and discard orientations which you don't want in your app.

Related

Xcode 6 ViewController content is smaller than the simulator screen

i'm developing app for both IOS7 & IOS8, and using storyBoard with size classes enabled.
app works fine in all simulators from iPhone 4s IOS7 to iPhone 6+
but the viewController is smaller than the screen in iPhone 5 with iOS7
app supports different orientations, i tried and canceled orientations but didn't work. i rested the simulator content, didn't work. I tried to change the initial view controller, didn't work. I cleaned the project, didn't work
To run your application in fullscreen in iPhone5 you must provide Launch Image for iPhone5 with resolution 640x1136.
If you are not including Launch Image of the size iPhone5 require then app will run in the centre of the screen, showing black area at top and bottom.
You can also refer here for more information.
Make sure there is a Default-568#2x.png in the supporting files

Orientation on ios 8

I have 6 tabs in my iPad application, all of the controllers have a single baseViewController. In my first tab there is a collection view and different layouts for landscape and portrait mode. When I launch the application and rotate for the first time, all tabs' controllers are loaded simultaneously. Every time I rotate the device it calls orientation methods for all controllers. Before iOS 8 everything was working fine but this issue occurs only in iOS 8.
Can anyone suggest a solution?

lock a view to launch initially in landscape (ONLY landscape) 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

Adding iOS 7 version of iPhone 4-inch launch image to project breaks launch image when run on iOS 7

I'm running into a problem on our landscape only app that targets iOS 6 and 7. Xcode gives me the following warning:
An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required.
If I add the required images, when I launch the app on iOS 7, I get a black launch image shown. On iOS 6, it displays correctly. But without the images, it works just fine on both iOS 6 and 7.
I am already using Asset Catalogs in this project, so I don't think that's an issue.
I would really like to get rid of this warning, but I haven't been able to figure out a way around it.
XCode is looking for Portrait orientation for iPhone. You need to provide it for the launch image, but don’t let your application to rotate when device is in Portrait mode.
In order to do this you need to do the following:
Go to General -> Deployment Info -> Device Orientation. Deselect Landscape Left and Landscape Right. Select Portrait, then Landscape Left and Landscape Right, order is important!
Add the following function to your code (if not yet):
-(NSUInteger)supportedInterfaceOrientations
{
return (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight);
}
That’s all!
In my case (landscape only app), I was able to fix it by doing the following:
adding portrait to the supported orientations for the iPhone in my Info.plist
replacing shouldAutorotate: methods with supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation in my view controllers.
added application:supportedInterfaceOrientationsForWindow: to my app delegate.
Also I had to make sure that in the Info.plist that the portrait orientation was listed first. Xcode had added it to the end of the list, but if it was there, it would still be a black display on launch. Moved to the top, it was properly detected by iOS when the app was launching.
LaunchImage import a 640*1136 picture,
BTW, LaunchImage in Images.xcassets
sample picture

iOS app starts in landscape mode

I have a strange problem. My app keeps starting in landscape mode. If I open it in simulator it rotates to landscape mode automatically. When I start it on iPhone it firstly starts in landscape mode and then shortly after it rotates to correct position. I have set "Initial interface orientation" in .plist to portrait, but that changed nothing.
I had the same problem. If you go to your Supported Interface Orientations you'll see
Item 0 ...
Item 1 ...
And so on.
If you edit this list so that Portrait (bottom home button) is the first item in the list then your app will open in portrait mode. You can still support other orientations as items 1 thru 3.
go to your supported device orientations and check if you have portrait mode selected
if you only support Landscape, write code
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
it work for me.
In XCode 6.4, I just unchecked all 4 of the device orientations and reselected them starting with portrait in the Deployment Info for the Target app. Apparently the order that they are checked here controls the order of the values in the plist file.