I am not using auto-layout, and I want to know if I can specify constraints between a UILabel and a UITextView. I tried what is mentioned here, but I got an error View hierarchy unprepared for constraint, so I looked up for that and found this, the accepted answer says that the views I am trying to add constraints to must be the subviews, if that is correct how can I add constraints so that the X position of my UITextView is set according to the height of UILabel ? I will post a picture so that it will give you all a clear idea:
Now I don't know if the UILabel is a single line or a couple of lines, and I want my UITextView to adjust it's X-position accordingly. This is the code I added, since I just learned about it please let me know if it is correct:
NSLayoutConstraint *xConstraint=[NSLayoutConstraint constraintWithItem:self.tvNewsDetails attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.lblNewsTitle attribute:NSLayoutAttributeBottom multiplier:0.45 constant:0];
[self.tvNewsDetails addConstraints:@[xConstraint]];
