1

I'm trying to set a constant between iPhone (4,5,6...) and iPad, but I can't do a difference between iPhone 4 and iPhone 6 for example, so how to do ?

enter image description here

Ben
  • 761
  • 1
  • 12
  • 35
  • make an iboutlet of the constraint into the code, and change the constraint constant according to the current device, there are plenty of ways to check for device type using code. – DeyaEldeen Jan 26 '16 at 09:47
  • First, its constraint. Second, if Size Classes is enable, please choose the `wAny hAny` below and change it according to the device type you want to config constraint to, then they will get the constraint that specify made for them – Tj3n Jan 26 '16 at 09:48
  • First all to run application also in ipad you need to set story board as UNIVERSAL application in places of using sizeclasses for iphone. To better understand regarding autkayout check https://developer.apple.com/library/tvos/documentation/UserExperience/Conceptual/AutolayoutPG/index.html – Badal Shah Jan 26 '16 at 09:48
  • 1
    @Zazu Im looking to a code but I only find about Pad and Phone – Ben Jan 26 '16 at 10:28
  • @Tj3n But it don't do for each iPhones sizes – Ben Jan 26 '16 at 10:32
  • @Ben then its no other way than u have to create IBOutlet for each constraint then use code to detect the iphone... – Tj3n Jan 26 '16 at 10:43

1 Answers1

1

this question has a script that i use for this purpose

Detect current device with UI_USER_INTERFACE_IDIOM() in Swift

use it, and define constraints constant according to the device, and that's it. :)

Community
  • 1
  • 1
DeyaEldeen
  • 10,847
  • 10
  • 42
  • 75