0

I have a uilabel in tableviewcell ,and the label use NSAttributeString to support both image and text. But I found when the label contains image or text only , the height of label is correct ,but when label contains image and text both ,the height seems not correct .the row height seems little more big than the actual height need

enter image description here

and if there is text or images only ,the height is right

enter image description here

and I was using my Own subclass from NSTextAttachment to construct image enter image description here

and the attachment code is like this enter image description here

4

1 回答 1

0

OK,这行代码好像行得通,但是我还是不知道为什么好 [textAttributeString addAttribute:NSBaselineOffsetAttributeName value:[NSNumber numberWithFloat:-4] range:NSMakeRange(0, textAttributeString.length)];

于 2014-12-08T10:18:09.173 回答