I am developing a navigation app using Swift UI.
For some reasons, some of the test device have enlarged buttons. They almost looks like they are zoomed in for some reasons.
I cannot replicate this issue using xcode emulator, please help
Correct - This is what suppose to look (pic from iPhone 6s)
Wrong - Below is from another iPhone 6s (test device from tester)
Wrong - Below is from beta tester on iPhone 11
Probably they have changed the font size on their iPhone should your App support dynamic types.
Try changing the font size on your iPhone or ask them if have done so.
Change the font size
Go to Settings > Display & Brightness, then select Text Size.
Drag the slider to select the font size you want.
Make the font even bigger
Go to Settings > Accessibility, then select Display & Text Size.
Tap Larger Text for larger font options.
Drag the slider to select the font size you want.
Source
You can set fixed size on the images to disable it.
Image(systemName: "magnifyingglass").font(.system(size: 20))
More Info
How do I set the size of a SF Symbol in SwiftUI?
Related
I'm using a storyboard with some compoments like labels and buttons. The problem is that the captions are too big for my mobile display so the last words will be cutted.
I noticed that the font size seems a little bit bigger than in other apps so I want to ask what the default font size is?
And if I reduce the font, however, there may be problems on various devices, e.g. the presentation on an iPhone or an iPad?
Is it necessary to create different storyboards, each one for every device or what is the usual procedure?
There is an option called "minimum font scale" which may be useful, and there is this built-in functionality to adapt your UI to different devices:
https://developer.apple.com/library/content/featuredarticles/ViewControllerPGforiPhoneOS/TheAdaptiveModel.html#//apple_ref/doc/uid/TP40007457-CH19-SW1
And a tutorial from a site that has helped me wrap my head around a lot of iOS concepts (this is the one I used, got updated for ios11)
https://www.raywenderlich.com/162311/adaptive-layout-tutorial-ios-11-getting-started
Solution With Xcode 9:
Xcode story board has an options to separate configuration for User Interface Elements for different size (iPad & iPhone) and different orientation (Landscape and Portrait), which are Any, Compact, Regular integrated with Size Class.
Size class also allows to set different font size for iPhone & iPad.
Follow these steps, for easy under standing, how to use Size class to solve your problem.
Add label in your story board - view controller layout
Select label and open 'Attribute Inspector'
There is a small '+' icon on left side of 'Font' attribute. Click on '+' icon. It will give you a small popover with size options for your label font.
For iPhone it will show you compact width and regular height by default set/selected. Now change/set height and width both as Regular and Click on 'Add Variation', which will add a new variation for font size for iPad (a device with regular height and width).
Change font size from 17 to 40 for variation with 'wR x hR' (As shown in this snapshot)
Here is result of variation in iPhone and iPad
In my IOS app there will be buttons with text on them. Everything looks fine only on Iphone 7, because it has screen size I've created on. When I switch to another screen size e.g. in simulator, text in buttons is truncated in the middle.
The best option to solve this problem would be to make font size scalable as screen size changes or slidable. How to make text in buttons visible at all in all screen sizes?
I'm working on an iPhone only app supports from iOS 8. I want to support devices from iPhone 4S in a portrait mode only.
I have a graphic design which is taking a fullscreen content. I'm using auto-layout to handle the views and making it work for all screens. But, I'm using a small assets to manage the design to work from iPhone 4S. When I see it in iPhone 6S/6, contents are very small and lot of extra spaces are getting wasted.
I want to increase the font size, image sizes when a device resolution is getting bigger. There are many screens in this app.
For e.g., I've a label with font size 10pt in iPhone 4S screen. Even
after scaling, I see that font size is small in iPhone 6/6S. I'd like
to increase the font size to 13pt or higher.
How to handle that? Any ideas would be appreciated.
UPDATE:
I'm supporting only for iPhone in a portrait mode. When we do that, all screens are having size classes with Regular Height & Compact Width. So, storyboard setting for different fonts will not have any change in the actual screens.
To manage Images for all devices add images to Images.xcassets folder for all devices by adding 1x, 2x and 3x images.
To display font according to size of device you can use size classes for different devices.
Tap small plus button in front of Font in Attribute Inspector and maintain size for different devices.
Thank you for other fellows.
Earlier, I wasn't aware of 'Minimum Font Scale' & 'Aspect Ratio' options in Autolayout.
After some researching, I could accomplish resizing of views and font sizes with them. Here are the few answers which helped me.
https://stackoverflow.com/a/28909109/1083859
https://stackoverflow.com/a/31853203/1083859
https://stackoverflow.com/a/25768875/1083859
I have an app designed for 5s with a font size of 13px. But when the same is run in iPhone6 Plus font is looking very tiny. Although position and size of the elements is adjusting accordingly to the size thanks to percentage based element position and layout.
Any idea on how to change the font according to screen size ?
Here is an example of how you can customize font for different devices (section Adaptive Fonts almost in the end of tutorial)
Short instruction how to do this:
Select label in Interface Builder
Press + button near Font and select device size, for which you want to have another font
Set new font for that devices
How can I get the default keyboard to be shorter like the keyboard on the right?
The standard keyboard is the left, how do I get it to have the height of the one on the right?
The left keyboard is not taller than the right keyboard— they are the same height, in points. The difference is in the scale of the screen; i.e. the pixels are smaller on the right. Assuming that these are the same device, the difference is caused by one of two things:
The app on the left is not updated to support the higher resolution screens of the iPhone 6 and 6+. To remedy this, you can either specify a .xib as your "Launch Screen File" in the target's General settings, or add a launch image for iPhone 6 and 6+ to your asset catalog.
The app on the left is running on a device which is in "Zoomed" view mode. To change this, follow this path in your Settings app: General > Display & Brightness > View.
Edit: A good tip for recognizing such resolution differences (on an iPhone 6 or 6+) is to watch the clock as an app launches. If it gets bigger, then your device is set to the "Standard" view mode, and the application has not been updated to support iPhone 6/6+ resolutions. If the clock stays the same size, then either the app has been updated to support iPhone 6, or the device is in the "Zoomed" view mode (or both).
You cannot control the height of the keyboard. The keyboard on the left is looks taller because this app hasn't been updated for iPhone 6/6+ screens, so the keyboard and everything else in the app has been stretched.
See this question for how to support the new 6 screen sizes.