I have developed a app in Xcode 5.1 for iOS 6.1 and above.
I designed the View controllers from the top without leaving any margin. When I run this on iOS 6.1, it starts from below the top bar that indicates carrier and battery, but on iOS 7 it overlaps the bar.
I searched and found that full screen was deprecated in iOS 7 onwards. This was the code I found on many blogs that states that adding it to viewDidLoad will make the viewcontroller start from below the bar in IOS 7.0. But this is not working for me.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Do I need to add something more. I want this app for iOS 6.1 and above and also for screen inches 3.5 and 4.
I figured out the solution for this.
In main storyboard, select view as IOS 7 and later and add 20 delta to y to your view.
So when you run your app in IOS 7 and later, it will automatically add 20 offset to your view.It will have no offset added for IOS 6.1 and earlier.
Related
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
I'm struggling with an issue using constraints under XCode 5.
I am building my app for iOS7 while trying to keep iOS6 UI compatibility.
I am currently facing one UI issue using Interface Builder.
I have a table view that adjusts according to the height of the superview using the constraints (set in Interface Builder).
It works perfectly under iOS7.1 portrait and landscape orientation.
My issue is that running on iOS 6.1, the views shrinks/enlarges depending of the superview height, BUT it goes 20pixels more on the bottom. It clearly is because of the status bar.
It doesn't make sense to me , since the autolayout should take care of this , right ?
I've tried to look for solutions here obviously, but i always find ways to go from iOS6 to iOS7 while preventing the view from showing under the status bar. It doesn't quite apply to my issue.
Any help on how I could/should solve this problem ?
Thx
Update the UIVIEW Frame programmatically when its ios version < 6
if ([[[UIDevice currentDevice] systemVersion] floatValue] < 7)
{
// Update frame
}
else
{
//Update the frame in UI
}
or check the below link, maybe its helpful
iOS 7 status bar back to iOS 6 default style in iPhone app?
I Have Developed an Application. In that one i Added a GMSMapView and also Two Buttons at the Bottom. If i run this Application on iOS Simulator Version 7.0 all the outlets on the XiB are Visible. But If i run this Application on iOS Simulator Version 6.1 one of the Button is not Visible. Can any one please tell what is the Reason why it is hiding one button if the Height of the Device is Same.
You can use delta value that will effect the layout for the ios 6 not to the ios7
if you are set view as ios 7 in interface buinder you need to decrease you y position show image below
-64 delta y because you use navigationbar at top so it's size 44 and +20 for status bar
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
}
}
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. ;)