I need some help in implementing this UI using Autolayout
I am creating UIButtons programatically
for (int i=0; i<10; i++) {
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.backgroundColor = [UIColor greenColor];
[btn sizeToFit];
[btn setTitle:@"user@example.com" forState:UIControlStateNormal];
[self.myCustomView addSubview:btn];
}
myCustomView is a UIView created in XIB . I have pinned myCustomView's leading,trailing & top edges to its superview . I have set the height of myCustomView to 44.
I need to add UIButtons as subview to myCustomView using constraints in such a way that the buttons should wrap to next line and myCustomView should increase its height based on its subview content.
http://i41.tinypic.com/3536ob6.png
Snippet of code to achieve this will be helpful