AutoLayout UILabel multiline

I have two labels in my View1. One of the label is multiline. First label is changing sometimes one line, sometimes more lines. Space between first and second label is fine with constraints. Problem is that second label always the same origin.y. After second label I need add button with code:

UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(100, second.frame.origin.y+ 10, 50, 100)];
        [btn.titleLabel setFont:[UIFont systemFontOfSize:11]];
        [btn setTitleColor:[UIColor colorWithRed:0.0 green:122.0/255.0 blue:1.0 alpha:1.0] forState:UIControlStateNormal];
        [btn setTitle:@"DATA" forState:UIControlStateNormal];
        [btn sizeToFit];

        [view1 addSubview:btn];

Source: ios

Leave a Reply