iOS 5 and iOS 6 - UIWebView difference in behaviour - iphone

I am testing some HTML code on UIWebView. And am also wishing to support both iOS 5.x and iOS 6.x. But there seems to be a problem about font size associated with iOS 6.x only.
That is, under rotation, iOS 5.x would make fonts slightly smaller when changing to portrait from landscape mode (which is desirable, since portrait's width is shorter). However, UIWebView in iOS 6.x would do just the opposite.
The problem does not come up when the same HTML code is rendered in iOS Safari (both 5.x and 6.x), as font size always scales as expected during rotation.
It could be something I've missed about UIWebView, hope somebody knowledgable could help to explain this.
Also, the above problem comes up on my iPhone 5 iOS 6.1 test device. Please comment if you do or don't find any similar problem. Wish to know if it is only associated with this particular phone (or its settings) only.
Latest Update :
The above problem should be related to how the project (which started long before iOS 6 was available) is laid out. As have set up a new test project with a UIWebView and a UIView in some different basic setups, and the text autosizing during rotation seems to be ok in both ios 5 & 6. The above problem may be due to custom layout adjustment code used which is good only in iOS 5. Really wish there were more compatibility between the 2 ios versions.

Please use the viewpoint setting to see the difference in ios 5 and ios 6

Related

Size Classes in iOS 7

I created a new app in Xcode 6 using Size Classes. After testing with iOS 7, I can't figure out how to get iPhone to display a certain size class while in landscape mode.
I first developed the UI with iPhone landscape as wAny hCompact, but iOS 7 doesn't recognize that. I had iPhone portrait in wAny hAny.
I then changed it so now I'm using wCompact hRegular for iPhone portrait. I then modified wAny hAny to be the landscape layout. But it's not using that layout when the iOS 7 device is in landscape.
Is iOS 7 able to use different size classes based on the device being portrait or landscape? If so, which size class should I be using?
Reference: Really helpful information about backwards compatibility with size classes.
ps. I'm not concerned with iPad because the device does not display a different size class based on the device rotation in iOS 8.
Size classes works in iOS 7 for sure. But only if you follow several rules:
The app is built using Xcode version 6 or later
The deployment target of the app is earlier than iOS 8
Size classes are specified in a storyboard or xib file
The value of the height component is not compact (yep, this is your case, it's not possible in iOS 7, unfortunatelly)
There is a little explanation here: https://stackoverflow.com/a/24976792/2190175
No I'm afraid that Size Classes were introduced in iOS 8. You could write some conditional code to run on iOS to determine the screen/view size/orientation and change the the layout that way when iOS 8 becomes your minimum target the conditional code can be removed.

iOS7 compatibility with App on iPad

Our current app doesn't work on the ipad 3 with retina display running ios7 beta 6.
The html page served between the is too big on the ipad, ie. ignores 100% width - therefore the user needs to scrolls around the page to see all the buttons and functionality rather than it fitting on one page.
This doesn't happen on the iphone 4 running ios7 (other models not checked) and it doesn't matter whether or not x2 is selected for the ipad zoom.
Has any one come across this issue, is this a media query fix or a iOs7 bug?
Just updating my answer based on what we've found last week and implemented for our app as a solution.
Although not entirely clear I believe the Question in hand above has to do with an HTML application running in webview vs. a web application in safari. Because 2x compatibility mode is being referenced in the question.
Issue:
Is not due to media Query but the viewport width=device-width is returning 768 instead of the 320 it returned in <= iOS6.x, when running an iPhone application in 'Compatibility Mode' on an iPad.
Fixing on the remote page
The best solution is to edit the viewport on the remote page by modifying the value of the 'width' attribute or removing it all together.
Fixing natively:
Few options...
1) Build the app as 'Universal'
2) I found somewhat passable results by executing javascript on webViewDidFinishLoad to decrease the scale
self.webView stringByEvaluatingJavaScriptFromString:#"$('meta[name=viewport]').attr('content','width=device-width, initial-scale=.41 user-scalable=no');"];
If you happen to be using PhoneGap/Cordova, issue was also identified and filed here: https://issues.apache.org/jira/browse/CB-4323
This should help:
http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review
iOS7 has been said to be the buggiest Safari version since 1.0.
There is no way to have a truly fullscreen experience on your website with iOS7. This was one of the wonderful aspects of iOS 6, and losing it is a major step backwards.
I hope that Apple comes to it's senses...

How to make iPhone4 and below version app compatible for iPhone5?

I have an application in iphone market which works for iPhone 4s and lower version. So now iPhone 5 has been launched which bigger size screen, my question is what all changes i have to do in my application so that it will be compatible with iPhone 5 also.
1) Do i have to rebuild my app for iPhone 5?
2) Do i have to make changes only in UI ?
3) Will the iPhone 5 will its make it compatible?
Your valuable replies will help me a lot. Thanks in advance.
Here is my answers,
1) Do i have to rebuild my app for iPhone 5?
If you want to utilize the complete screen space, you can add Default-568h#2x.png and rebuild the app and release it.
2) Do i have to make changes only in UI ?
You can utilize the complete screen space for iphone 5. You can code for screen modifications in case of other iPhones.
3) Will the iPhone 5 will its make it compatible?
Yes. It will make it automatically compatible. It will add a black strip on top and bottom to compensate for the extra space in the screen unless you add Default-568h#2x.png.
If your app uses the standard UIKit provided by Apple, you only need to add a 4 inch launch image to your app, and it will automatically resized itself. But if your app using custom controls or graphics-heavy like in games, you might want to adjust the images and take advantage of the larger screen.
You also have to make sure the methods you used do not deprecated on iOS6 to prevent the app from crashing. Some references if you need further reading.
To make older app compatible with iPhone 5 You need to look for Following things.
Latest Xcode version 4.5.
Open your project and select Upgrade settings for new version.
Add Default-568h#2x.png for new resolution .
For UI you have to change your xib's object autoresizing property.When you select View Go to
inspector and select size property It will show you None, Full Screen, Retina 4 options . Set autoresize property for all your Buttons , labels and check xib for retina 4 and None both.It is same like you set it for Landscape and portrait .
5.Some other changed will be in code because some method has been depreciated for ios 6.0.
6. After doing all this .You can run it on iphone 5 simulator for testing.
I have an app that was using GLKMatrix3 and its supporting functions. I found that the GLKMatrix3Multiply function would always crash on iPhone 5 hardware. Easy to workaround using GLKMatrix4 instead, but the point is that I would never have found the problem without actually trying my app on iPhone 5 hardware.
I was told to file a bug for the GLKMatrix3 problem, so maybe this will be fixed. But the code runs just fine in the iOS 6 simulator.
I learned from this that, whether or not you need to rebuild your app for iPhone 5, you do need to at least run your app on a device before advertising support for that device.

Adjust iPhone 5 Screen Size Without Using Autolayout

Enabling Autolayout in .xib or .storyboard and adding a splash screen of 640px by 1136px enables iPhone 5 resolution support for the taller screen.
However, doing so, my app started to display some funny things where I assume autolayout is not a great idea.
I am wondering if there is a way to enable iPhone 5 device support, i.e. fix app's resolution without using Autolayout? Maybe I can set in the code?
If yes, then I will have no need to create 2 storyboards or nibs to support iOS5- and iOS6.
If you weren't using Autolayout before, you won't need to use it for iPhone 5 support.
When you're putting your interface together, you just need to check your bindings, and toggle between the taller phone size, and the regular phone size, as described here:
Xcode Storyboard displaying the new iPhone 5 screen size?
If your screens look fine in both screen sizes then you're done.
If you are doing a lot of coding to show your UI, then you'll have more work to do.
I found a great answer a couple weeks ago (link below). You will copy and paste your older iPhone Storyboard, rename it to reflect the iPhone 5, and press the button that expands the screen size, found on the bottom of the layout grid. Some minor coding adjustments might be needed, but this sample code is used in the AppDelegate to detect which device is running, and hence, which Storyboard to use. You'll just have to duplicate your interfaces, but these GUI changes can be made without code and without AutoLayout (also good to note that AutoLayout removes iOS 5--and lower--compatibility)
xcode 4.5 how to pick storyboards at launch

Why are UILabel line breaks at different places on the device compared to interface builder and the simulator?

I recently ran into a few problems with several multiline UILabels that I had created in interface builder. In interface builder, each label was large enough for the text it contained. Similarly, when I ran it in the simulator each label was large enough. But when I ran it on my device, some black magic caused the line breaks to occur at different places and not all of the text was visible.
I resorted to deliberately making the offending labels too big in IB, which did the trick, but I was left curious as to what was causing the differences. Does anyone have any idea what it might be?
I was using the interface builder in Xcode 4.2 through MonoTouch. The phone is a 3GS and runs iOS 4.3.5, but my simulator seems stuck on iOS 5 (which I guess might be something to do with it).
Looks like the most likely explanation is that the different versions of iOS use a slightly different System font. Interface Builder and the iPhone simulator were probably using one font, but when I put it on my iOS 4.3.5 phone it was using another. I think it is most likely to be something to do with the OS and not the device because I have since been able to try it on an iPhone 4 which was running iOS 4.2 - the behaviour was the same as on my 3GS.
Thanks to Krumelur and Mark Adams for the comments!