The problem is that the adjustor up/down arrows only update in integral (+/- 1) steps. I want them to update in small steps, say, +/- 0.05 increments. Is there any way to do that?
Lack of any documentation explaining how to do it and the fact that your question is 3+ years old suggest that you can't actually change the increment value of the stepper for your inspectable properties in IB.
What you can do, however, is to create another property based on the one you want to adjust, and scale that one so that increments of 1 correspond to steps of the size you want. For example, designers are probably used to thinking about opacity in terms of percentages, so you could create an alphaPercent
property with getters and setters that scale the alpha
property up by 100:
@IBInspectable var alphaPercent : CGFloat {
get {
return self.alpha * 100
}
set(percentage) {
self.alpha = percentage / 100
}
}
If you add that property to an @IBDesignable
view you'll be able to use the stepper to change the view's opacity by 1% with each click.
How about other properties of the controls? Can you display a slider for a CGFloat instead of a numeric field? Can you add a tooltip? Can you add static descriptive text?
None of that is currently possible. If you have a long-term need for less technical users to make user interface adjustments (e.g. if you're skinning the same basic app for a number of different customers), it might make sense to build a version of your app that provides an edit mode. Looking at the Tweaks framework from Facebook might give you some ideas.
double
,long
,float
,NSInteger
, etc.)? β Amalekite@IBInspectable
, Xcode will always render those to default controls (eg. color picker forUIColor
, value adjustors for number based types, etc..). However, wonder what would happen if you simply type decimal value directly in the filed ? (that works when setting aNSLayoutConstraint.constant
). Some references by @Nate Cook and others : gist.github.com/natecook1000/4269059121ec247fbb90, medium.com/anantha-krishnan-k-g/… β Inexactitude@IBDesignable
directive after I'm done. It's unreliable, a time sink to implement, and severely bogs down Xcode. β Wagtail