design - iOS screen size in code, is this optional? -


in apps theres settings screen sizes. vs regular constraint settings, whats advantage vs disadvantage?

example:

 struct setting {         struct small {             static let phonese: cgfloat = 11.0             static let phone: cgfloat = 13.0             static let phoneplus: cgfloat = 14.0         }          struct medium {             static let phonese: cgfloat = 12.0             static let phone: cgfloat = 14.0             static let phoneplus: cgfloat = 15.0         }          struct large {             static let phonese: cgfloat = 13.0             static let phone: cgfloat = 15.0             static let phoneplus: cgfloat = 16.0         } 

these values specific font size values.

the values change purpose, values might font size or img sizes. practice or overkill?

it usually isn't "good practice" code against specific devices. or in other words, is "good practice code against size classes (using auto layout constraints) , use dynamic type (instead of specific font sizes) possible. why? because when apple releases new - 10.5 inch ipad pro last april or rumored iphone pro september - won't have much, if code.

it "just work".

that said, here's reasons may need code against specific devices - or more accurately, specific screen sizes:

  • ui changes orientation on ipad , iphone "plus". size classes regular no matter orientation.
  • font sizes, in example.

i'm sure there's more. in these 2 cases - , really, in cases - it's "good practice" try hard use apple gives you. refactor ui if possible. save on unnecessary ongoing maintenance.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -