Using Size Classes in IBInspectable properties
Asked Answered
C

1

17

Is there a way we can make our IBInspectable properties feature Size Classes in Interface Builder? (Similar to Font)

enter image description here

Clicking the '+' sign would allow you to choose a different font (size and other properties) for a different size class.

I'm asking because I created a custom view which features a width property and I want to make that width different on some size classes.

Catarrhine answered 2/6, 2015 at 7:16 Comment(1)
This would be awesome and make things so much neater, hope this feature comes soon, but not soon enough for my current project :(Cyr
J
8

I'm afraid there is no option for IBInspectable properties yet, but you definitely can respond to size class changes via UITraitEnvironment protocol and UIContentContainer protocol that already implemented by UIView and UIViewController (see WWDC 2014, Building Adaptive Apps with UIKit to see more about trait collections and trait environment). The font property seems get handled by Xcode just like the constraints or installed.

Jewelljewelle answered 2/6, 2015 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.