The new size classes for auto layout in Xcode is great, but is it also possible to change other things than constraints like font size using size classes?
This is actually quite easy once you find the correct button. There is a small '+' sign to the left of the font select control in the inspector. Press it and choose the size class you want. Then, select different font properties for that size class.
Related
i want to set Device-Specific font of UILabel and UIButton using storyboard.
Any one can help me to achieve this?
You can set Label Font Size based on Device using Storyboard. To make it you have follow some steps like below.
First go to the Attributes Inspector panel in storyboard.
Click on this + Symbol of Font Property.
Now set the variations for other devices, Like Compact Width and Compact Height or etc. Set it based on your requirements.
Finally, it will look like,
you can set this property multiple times as per your device specifications like iPhone or iPad etc. You need to define only variations so it will automatic set font size and fonts also.
Hope you get it.
I have created a Launch screen.I have added one image & label on it.Now for diffrent screen size devices i am able to increase the size of image with autolayout.But i am not able to increase the font size of label.I can't use custom class of label for storyboard.So is there any way with i am able to increase font size for multiple devices on launch screen.
Option for different font size for different size class is available in storyboard.
NO. It is not possible to implement custom font for LaunchScreen, since LaunchScreen will be loaded before your custom fonts load. Better create different images with the text you want to display.
Well it is not possible you can write code for a launchScreen and handle some logic as for a conventional ViewController. Also you cannot use a custom class of label or extension. You can use only Auto-Layout and size classes. The detailed explanation is in the link
I'm trying to create something like a sports app, which contains a scoreboard. I created a View in my storyboard and dragged some UILabels inside the view. Then I added the constraints to the labels.
Now when I run the app on an iPhone the screen looks nice. All fonts and labels have the right size. But on the iPad is looks something like this:
But it should look like this:
How can I scale up the font size and the labels so it looks perfectly on the iPad?
Thanks
You can use size classes. Select the label you want to scale, then on the Utilities panel click the tiny '+' button near the "Font" label. In the dropdown list select "regular width" > "regular height". And then in the newly appeared Font setting select a bigger font size:
If you're not using size classes then you have to either change the font size in code (use UI_USER_INTERFACE_IDIOM() macros to determine whether you're running on iPhone or iPad), or simply create a different storyboard for the iPad interface (add a new storyboard to the project and then in your app's Info.plist add the "Main storyboard file base name (iPad)" key with your new storyboard name as a value)
You can specify the font size to be used for each size class. This can be configured in Xcode storyboard editor as described here.
My app doesn't look good on large screens. On my main screen, I use a segmented control and on an iPad (Mini), it looks unprofessional, because the text size doesn't scale up in these segmented controls. The segmented control itself is easy enough to enlarge by setting constraints tying it on the left and right to the superview.
When I try to use size classes, I can't find a way to increase the font size in my segmented control for larger (regular width, any height) screens. I've tried this in a one screen throw-away app for learning purposes. I'm new to size classes, so maybe I'm missing something obvious.
Is there a way to scale up the font size on segmented controls using size classes? If not, is there another way to do this programmatically? I'm using Swift and am not familiar with Objective-C. If you can spell out any solutions in detail, that would help, since I'm still relatively new to iOS programming.
You can use size classes in Interface Builder to substitute a different segmented control with a larger font size when you're running on iPad as opposed to iPhone. But you cannot use size class in Interface Builder just to set a different font size on the same segmented control.
I'm using XCode6's Interface Builder with different size classes, and want to create a UILabel with a custom font that has a different font size constraint for different screen sizes. According to apple:
https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/ChangingtheFontforaSizeClass.html#//apple_ref/doc/uid/TP40014436-CH12-SW1
you should be able to accomplish this by clicking the + icon next to the font field in the property inspector and choosing different font sizes for the different size classes.
This seems to work perfectly well for me when using system or other fonts that already come embedded in XCode, however, when I use a custom font that I've manually embedded in my project, it no longer respects the constraints and defaults back to the system font and the default font size.
Is this a bug with XCode, or am I doing something wrong?