コードを使用してセルの高さを計算したい。私のテキストには、などのhtmlエンティティが含まれています<br>,<b>
。次のコードまたは同様のコードを試しました-
//create a CGFloat variable
CGFloat _height = 0;
//find out the size for your text. Instead of 255 insert the width of your label
CGSize _textSize = [yourString sizeWithFont:[UIFont systemFontOfSize:kFontSize] constrainedToSize:(CGSize) { 255, 9999 }];
//add the height of that CGSize variable to your height in case you will need to add more values
_height += _textSize.height;
1行のコードとプレーンテキストでは問題なく機能しますが、htmlタグを含むテキストには問題があります。
助けてください。