Font size in button change as screen size does - ios

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?

Related

Enlarged buttons and screen

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?

Xcode changing a button background image for various devices

How can I change button background image - I need one for all iPhones and another (due to size) for iPads. I have square buttons imitating keyboard with smaller background image. On iPad font on buttons is twice bigger, but they are not squares anymore. So I made bigger backgroud image to make them squares again, but how can I change that image only for iPads in storyboard. Is it possible?
Thanks.
on iPhones:
on Ipads:
You can design the layout using size class. The size class for iPad is R*R.

How to adjust font size for various iPhone screen sizes in iOS?

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

UIButton image. Auto size to real image size. Device based

I have a universal application.
I have a main menu with 2 buttons. The button have a different size\shape on ipad and on iphone.
btn_main_all#2x~ipad.png
btn_main_all.png
I'm using xcode filename to get the good image from each device(work great). But the image are not resized to the good specific size. (i've try each combinaison in storyboard... top left, fit..., etc.
How can I have the button to get the real image size ?

iOS how to get the exact font and size of the keyboard shown for a text field?

I'm interested in getting the exact font size and name of a keyboard currently displayed on a screen, as a first responder for a UITextField. I see that iPhone6 and iPhone 5 use different font size, and I think custom keyboards can be using an even more diverse set of fonts.
How can I extract the font in which the letters on the iphone keyboard are drawn?

Resources