Developing fullscreen 4inch app in xcode [duplicate] - ios

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How do I support the taller iPhone 5 screen size?
How to make my app 4inch-ready? My app in iOS6GM simulator looks not 4inch-sized.
Is there any option in xcode to use all 4 inches?

Some users have reported that it was fixed after adding the startup image Default-568h#2x.png (see below).
For updating to iPhone5 I did the following:
Autorotation is changing in iOS 6. In iOS 6, the shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientationsForWindow: and shouldAutorotate methods. Thus, I added these new methods (and kept the old for iOS 5 compatibility):
-(BOOL)shouldAutorotate {
return YES;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Then I fixed the autolayout for views that needed it.
Copied images from the simulator for startup view and views for the
iTunes store into PhotoShop and exported them as png files.
The name of the default image is: Default-568h#2x.png the size is
640 x 1136 and the screen size 320 x 568.
I have dropped backward compatibility for iOS 4. The reason is that
this new Xcode does not support armv6 code any more. Thus, all
devices that I am able to support now (running armv7) can be upgraded
to iOS 5.
That was all but just remember to test the autorotation in iOS 5 and iOS 6 because of the changes in rotation.

Before iPhone 5 release, I just use
#define kViewHeight 460.f // or 480.f if you don't have a status bar
#define kViewWidth 320.f
But now, I would like to use
#define kViewHeight CGRectGetHeight([UIScreen mainScreen].applicationFrame)
#define kViewWidth CGRectGetWidth([UIScreen mainScreen].applicationFrame)
instead.
But I'm not sure whether it is a good solution. As you see, you would dispatch CGRectGetHeight([UIScreen mainScreen].applicationFrame) every where you use kViewHeight. I've tried to use
extern float kViewHeight; // in .h
float kViewHeight = CGRectGetHeight([UIScreen mainScreen].applicationFrame) // in .m
but failed with a compile error.
Though it works well, I think there must be a better workaround. ;)

Related

Ios app strange rotation behaviour after iOS 8 SDK update

I've been developing an iPad app which was working fine until i updated my Xcode to version 6 and my iPad to iOS 8.The problem i am encountering now is that when i change the orientation of my iPad i can catch the event but the views do not rotate accordingly.To be specific in my iPad with iOS 7 app rotates itself size of the views stay the same; for example if i start the app in portrait mode and change rotation to landscape there is a space on the right side of the uiview.In my iPad with IOS 8 views do not even rotate itself and stay the same all the time.I'm not using auto layout and app used to work like charm before IOS 8 SDK release.I need your help on finding articles and cause of the problems.Thanks in advance
probably the cause of problem is this line but i need to have this because otherwise my app won't release uiwebview from memory.
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
self.view.window.rootViewController=self;
}
Rotation handling has changed in iOS 8. Methods such as willRotateToInterfaceOrientation:duration: and didRotateToInterfaceOrientation: are now deprecated and replaced by viewWillTransitionToSize:withTransitionCoordinator:. Depending on how you're handling rotations in your app, you may have to make changes in your code to adapt to the new methods. Check chapter "Handling view rotation" in the UIViewController reference docs

Change GUI when selecting iOS 6 in Xcode 5

When I am using Xcode 5 and I set the deployment target as 7.0, the application runs perfectly with both 4-inch and 3.5-inch displays.
I have downloaded the iOS 6 SDK already.
When I change the base SDK to iOS 6 and set the deployment target as iOS 6.1 my GUI is affected in a way that changes every image, navigation bar, images and all other controls.
I am not using autolayout and have two .xib files for one UIViewController in each class.
So, how can I get fix this?
Thanks in advance.
When you compile with the iOS 6 SDK , you application is created with the iOS6 images, views, keyboards, etc...
You can't use iOS7 views if you are compiling for iOS6, you need to compile for iOS7, even thought your app is iOS6 compatible (setting the deployment target to iOS6)
Long story short - you can't use iOS 7 GUI in your iOS 6 app. If you want you can just create your custom GUI and use it in your app. But some elements will be different, you better read this guide:
Apple docs
Also if you build you app for different versions of iOS you better use auto layout:
Ray Wenderlich - Auto Layout Tutorial in iOS 7: Part 1
Ray Wenderlich - Auto Layout Tutorial in iOS 6: Part 1
Some issues of transition from iOS 6 to iOS 7:
Status bar and navigation bar issue in IOS7
Use this code:
if([[[UIDevice currentDevice] systemVersion] isEqualToString: #"7.0"])
{
//do stuff
}
else
{
// code here
}
When compiling for iOS 7 you are using iOS 7 specific GUI elements (that differs a lot from iOS 6). Phones that are still on iOS 6 (about 16%) will however see the iOS 6 GUI elements for obvious reasons, even if you compile it for iOS 7.
There is really no way to resolve this, you should simply develop for iOS 7 and let iOS 6 users still have iOS 6 GUI elements.
If your application is working fine in iOS 7 and you need to run it iOS 6 then you need to manage the application using this method:
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending){
//CGRect gridFrame;
if ([[UIScreen mainScreen] bounds].size.height == 568) {
// Do nothing if already managed
}else{
// Do nothing if already managed
}
}else{
//CGRect gridFrame for ios6;
if ([[UIScree`enter code here`n mainScreen] bounds].size.height == 568) {
//Manage frame here
}else{
//Manage frame here
}
}

How to support orientation in iOS 5 and 6 without having to modify every single view controller file? [duplicate]

This question already has answers here:
Supporting both iOS 6 and iOS 5 autorotation
(6 answers)
Closed 9 years ago.
My iPad app is set to support both landscape orientations (left and right). When I run it in the 6.0 or 6.1 simulator it behaves as expected. But in 5.1, it is locked to portrait (up or down, I can't tell) and doesn't re-orient when the simulator is rotated.
Edit: This has been marked as duplicate to this question: Supporting both iOS 6 and iOS 5 autorotation
I'm changing the question to ask, how can this be done without having to add this function:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
To every view controller?
You need to override the below method like this to support orientation as per your requirement in ios 5.1 and early versions...
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

Support Retina 4-inch with a deployment target to 4.3

I'm developing an iPhone and iPad app with latest SDK and Xcode 4.5.2.
My client said me that the app has to support iOS 4.3 and above.
So, if I target iOS 4.3 I can't use:
Storyboards.
Auto-layouts.
I have to create XIB for every ViewController, but:
What must I do to support Retina 4-inch screen?
and
What must I do something to support iOS 5?
Simply design your app for 3.5" screens, and make judicous use of autoresizing masks.
For supporting Retina 4-inch screen, here is good answer to that
and YES Storyboards and Auto-layouts are not for iOS 4.3
More on iOS 5, you don't need to do and special coding for that
and YES you can support Retina 4 inch with deployment target set to iOS 4.3
Hope this info helps you..
Have a look at these two links
Screen size of iphone 5
Naming convention for iPhone 5 images?
I don't see why these wouldn't work.
Move from comments
#VansFannel I would do this in code and not actually on the xibs. So I would have something like
if(IS_IPHONE5()) {
// do one layout
} else if(IS_IPAD) {
// do this layout
} else {
// do the final layout
}
In info.plist file remove the option of Launch screen interface file base name and you wont get the issue

iOS 5 and iOS 6 UITabBarController MoreNavigationViewController rotation

My project is based on UITabBarController with multiple UINavigationContollers. I am adjusting app to support rotation in iOS 6. I have made subclass of UITabBarController so that I can block rotation. That works perfect. But there is problem with MoreNavigationViewController. On iOS 5 it rotates and on iOS 6 it does not. My goal is to block it. I have to support all orientations (in Info.plist) because I am using MPMoviePlayerViewController which sould adjust to rotation. Is there a way to subclass MoreNavigationViewController?
If anyone will have the same situation this is what I have done to solve it:
Info.plist support all orientations
In custom subclass of UITabBarController I have added this method
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
Works both iOS 5 and iOS 6.

Resources