Here is to hoping it is a simple setting.
I cannot enter a constraint value with decimals in IB. Whenever I enter a value with decimals and press enter, the system rounds it!
I don't have this problem when creating constraints in code. Only in IB.
Is there a way?
Yes, you can.
Enter the value with a "f" postfix like this:
Click Priority. notice how the effective constraint value changes to 0.5:
It has to be done programmatically, I believe. As of Xcode 6.3, constraint constant values seem to be restricted to integers in the storyboard editor (unlike multiplier values, which can be decimals).
For Googlers, here's how to do it:
To specify a decimal value for a constraint defined in a storyboard, you can set the constant property of a constraint iVar. Here's an example of setting a height constraint to 0.5f:
In your header:
@property (nonatomic, retain) IBOutlet NSLayoutConstraint *separatorHeightConstraint;
then connect the IBOutlet to the constraint in the storyboard.
In your implementation:
-(void)layoutSubviews {
[super layoutSubviews];
self.separatorHeightConstraint.constant = 0.5f;
}
That's all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With