Reputation: 201
I am designed my screen in xib using autolayout(xcode 6). I have to redesign the screen programmatically using autolayout.
I have 4 views in my screen horizontally. I have to hide the third view and move the fourth view to third view's position using autolayout.
How do I update the constraint programmatically.
Upvotes: 2
Views: 651
Reputation: 2915
You may use NSLayoutConstraint
and assign proper IBOutlet
to any of your constraints and then where you wants to change the view size use constant
property of NSLayoutConstraint
to change the value.
e.g
in your viewController.h
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *tempConstraint;
some where in your viewController.m
tempConstraint.constant = 50; // or what ever you want
Upvotes: 3