Swift / iOS - Trigger scrollview on smaller screens

708 Views Asked by At

I have an app that I've built around a pretty tableview, and everything looks great on iPhone 6 and up.

When you select a cell on my table, you're presented with a details page with some content. The content fits perfectly on screen bigger screen sizes, but it needs to scroll on iPhone 5 or smaller.

I don't have anything fancy on the detailed view. Just a couple labels, text fields with small amts of text, and a button.

Can anyone offer any suggestions/direction on how to easily do this? I'm fairly confident I can get there with a little help.

Thank you!

iPhone 5s:

iphone5s

iPhone 6 and up:

iphone6

1

There are 1 best solutions below

2
Ashley Mills On

I assume you're thinking of scrolling

Bee Coffee

Roasters: Roastery

To fit this on a smaller width screen you should probably just reduce the font size a little - maybe scale according to screen width?

If, say, Font.font(name: "some font" size: 36) looks good for you on a 4.7" iPhone (where screen width is 375pt) , but too large on a a smaller device, you could try scaling the font based on the screen width…

let fontSize = UIScreen.main.bounds.width / 375  * 36
let font = Font.font(name: "some font" size: fontSize)

Alternatively you can set the minimum font size for a label in your storyboard…

enter image description here