iOS 7 custom fonts alignment - ios

I've used a custom TTF font (Gotham) when implementing the layout of an app on iOS 6. I've noticed its baseline was always a bit higher than regular fonts, but just nudged things around to fit.
Now that I've updated to the iOS 7 SDK, the font placement is closer to that of regular fonts when running on iOS 7 devices, but still looks nudged on iOS 6 devices.
So it looks like Apple fixed what caused that vertical shifting on the baseline when interpreting the font metrics for iOS 7, but left iOS 6 untouched.
I've already tried modifying the actual TTF ascender, descender and line gap properties using Apple's Font Tools suits according to this blog post and many answers here on stackoverflow, it does help on iOS 6 but doesn't change much on iOS 7.
My question is: is there something I can do to use a custom font on iOS 6 and 7 without needing to tweak each label depending on the running iOS version?
I know this has been mentioned on the iOS 7 release notes, but I don't want to add tons of conditional clauses on my code to nudge the labels differently for iOS 6 or iOS 7 devices.

Editing the TTF file was the solution.
I've followed the suggestion from this answer and opened my TTF files on Glyphs and exported them again. Glyphs adjusted the ascender and lineGap values to something which is probably correct and the fonts behave pretty much identically on iOS 6 and IOS 7. The baseline now is even very close to the system fonts.
There are still some minor vertical differences, but apparently this happens with every font on iOS 7, even on system fonts, but it's much less noticeable.

Related

App run on simulator does not respect points or fonts from storyboard [duplicate]

This question already has an answer here:
How to efficiently use Autolayut and Auto-Resizing in same target?
(1 answer)
Closed 5 years ago.
I am working on new features (with Swift) on a legacy project ( Objective-C ) project.
Everything that I am receiving from designer (dimensions in points, font dimensions) put into storyboard or xib files got bigger in old project.
In SIMULATOR, here is an example with a uiview height and font dimension for iPhone 7
We tried:
Designer gives all dimensions in points. He is currently designing for iPhone 7/6. I am using in storyboard iPhone 7 view.
In a new project the correspondence is 1:1.
In the legacy project everything shows a little bigger.
What shall I search?
The iPhone 6 was introduced alongside iOS 8 and Xcode 6. As part of the introduction of the larger screen sizes, a legacy path was created that would allow older apps to run in a mode as if they were on an iPhone 4/5 screen size, simply scaling up the interface. This was intended to give app developers time to opt into the native, larger resolution of the iPhone 6 and 6 plus. In your question, I noticed this:
The larger battery icon is from your legacy app, while the smaller is from your brand new application. The contents of the status bar being scaled is a sure tell sign that the app is in this legacy mode. (Also, the interface often appears kind of fuzzy)
Therefore, I think your legacy app must have never adopted the launch screen storyboard or xib file that is needed to take advantage of the native resolution of the larger devices. To adopt it, you can see this answer.

Justified or Natural text alignment before iOS 7 Warning

I have an iOS App that is targeted to iOS 6 and above (I know, I know. But a disturbing number of our users are still on iPhones that have never been updated) and I'm seeing a warning when I compile my app:
Justified or Natural text alignment before iOS 7.0
This is seen for each place I've chosen "natural" text alignment for a control in my xib files. This is confusing to me, because the docs clearly state that NSTextAlignmentNatural is "Available in iOS 6.0 and later."
NSString Documentation
No warnings are presented when I set the alignment in the code, only from the xib.
Unfortunately, I am unable to test this myself because I don't have an iOS 6 device. Is this a warning that I just need to ignore, or could issues still arise in the older devices?
I just made a test project and got the same result with a UILabel set to justified. I repeated with a UITextArea and didn't get the error, so it seems to only relate to setting justified on UILabels.
I ran the same code on an iOS 6 device I have here and didn't get a crash, it just stayed left aligned, so you can probably ignore it, but it is very odd.
Perhaps you could try setting attributed text on the UILabels instead and see if the same thing happens.
UILabel set to Left-justif,like this
setting

Customize system fonts with size and attributes for iOS

In my app I need to support iOS since iOS 7. As you know iOS 9 uses new system font "San-Francisco".
Is it possible some how to use system font (to make native font for operation system) with setting size and attributes like Light, Medium, Bold, Italic, etc?
I found only one solution to hard code font name as for iOS 9 use "San-Francisco" and for less use "HelveticaNueue".
Maybe some one know a better solution.

Size classes not support UI elements for regular width and regular height in IOS

I developing an iPad application to support landscape only. I have chosen the size classes with Regular Width and Regular Height size. Whenever placing UIView or UI elements and run in the device, It works fine in the IOS 8 but it wont display in the IOS 7. seems looks like size class compatabile issue. Can anyone share your thoughts about how to resolve these UIview to display even in the IOS 7.
Thanks In Advance!!
iOS 7 Does not support size classes. I had this issue and I resolved it by forcing iOS 8 compatibility.
Unfortunately I think your best bet (which is kind of terrible) would be to branch your code and make two separate storyboards one for iOS7 and one for iOS8. That being said, given you are only supporting iPad min and iPad normal, you could do two separate storyboards depending on which device it is.
I know neither of these 3 options is ideal but thus is the cost of backwards compatibility.
Summary:
punt on iOS7
develop an iOS7 specific version and an iOS8 version
develop a separate storyboard for iPad mini and iPad Normal

iPhone 6 Plus support fonts issue

I'm starting on adding iPhone 6 support for my app.
I don't want to use Size Classes since the app runs on iOS7 as well.
I'm planning on using auto-layout for views positioning but I'm not sure how to handle font sizes.
I want to make some of the fonts bigger on iPhone 6 plus.
How can I do that using Auto-Layout without Size Classes?
You can use size classes and support iOS7, it's an Xcode related feature to help you design the behaviour of your app.
Get the latest version of Xcode, set the deployment target to iOS7 and start designing your ViewController's using size class.

Resources