i have added 4 views in parent view vertically.I have given them below constraints
- equal width to parent
- fix height of 70
- vertical margin between views of 1
- center x of parent view
Now the text in labels can grow it's not static.As of now text inside label was showing vertically center so i added below code to make text align to the top of label not show in center vertically of label (code from here)
//Calculate the expected size based on the font and linebreak mode of your label
// FLT_MAX here simply means no constraint in height
CGSize maximumLabelSize = CGSizeMake(296, FLT_MAX);
CGSize expectedLabelSize = [yourString sizeWithFont:yourLabel.font constrainedToSize:maximumLabelSize lineBreakMode:yourLabel.lineBreakMode];
//adjust the label the the new height.
CGRect newFrame = yourLabel.frame;
newFrame.size.height = expectedLabelSize.height;
yourLabel.frame = newFrame;
if i use above code with label then it gives me height of 67.201 accroding to some text but the height should be more because text is more but if i not use above code then text is placed vertically center inside label.
I want to make text to top aligned of label not center vertically.So that height of label should decrease it should not have any top,bottom padding.