IOS assigned row height

I calculate the size of the UILabel (only the height here) from the text of the dynamic length. And I draw the border of the label layer to render the label frame. Sometimes I see a โ€œregistrationโ€ above and below the label text, but not always. I do not want to fill. I suspect it refers to an attribute string, since I never encounter such a problem in a โ€œnormalโ€ string label.

I see this (note the filling in the first line):

enter image description here

I want it:

enter image description here

Relevant Code:

-(void)setupQuestionView { [self.questionView setAttributedText:[self.allContents[_itemIndex] objectForKey:@"Question"]]; // new question view height CGSize constraint = CGSizeMake(kCellWidth - kLeftMargin - kRightMargin, FLT_MAX); CGSize size = [self.questionView.text sizeWithFont:[UIFont systemFontOfSize: kFontSize] constrainedToSize:constraint lineBreakMode:NSLineBreakByWordWrapping]; [self.questionView setFrame:CGRectMake(kRightMargin, kTopMargin, kCellWidth - kRightMargin * 2, size.height)]; [self.questionView.layer setBorderWidth:1.0f]; // debug } 
+4
source share
1 answer

Are kLeftMargin and kRightMargin equal? I could not find anywhere, perhaps I am mistaken.

+1
source

All Articles