UILabelの正しい高さを設定するためにCGSizeを作成しようとすると、リークが発生します。heightForRowAtIndexPathで高さを設定しているときにも、同じリークが発生します。
これはリークしているコードスニペットです:
CGSize size = [news.news sizeWithFont:[UIFont fontWithName:@"HelveticaNeue" size:12] constrainedToSize:CGSizeMake(230.0f, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
UILabel *newsLabel = [[UILabel alloc] initWithFrame:CGRectMake(65, 50, 230, size.height)];
newsLabel.font = [UIFont fontWithName:@"HelveticaNeue" size:12];
newsLabel.textAlignment = NSTextAlignmentLeft;
newsLabel.text = news.news;
newsLabel.numberOfLines = 0;
newsLabel.lineBreakMode = NSLineBreakByWordWrapping;
newsLabel.textColor = COLOR_DARK_GRAY;
newsLabel.highlightedTextColor = COLOR_WHITE;
newsLabel.backgroundColor = COLOR_CLEAR;
[cell.contentView addSubview:newsLabel];
[newsLabel release];
リーク機器にリストされているリークは次のとおりです。
リークされたオブジェクト:icu :: UCharCharacterIterator Responsible Library:WebCore Responsible Frame:WebCore :: LineBreakIteratorPool :: take(WTF :: AtomicString const&)
また、同じ線を指す別のリーク:
リークされたオブジェクト:icu :: UCharCharacterIterator Responsible Library:WebCore Responsible Frame:WebCore :: acquireLineBreakIterator(unsigned short const *、int、WTF :: AtomicString const&)
他に何か提供できることがあれば、喜んでそうします。上記の1行(CGSizeサイズの作成)をコメントアウトすることで、リークしている行であることを確認しました。シミュレータとデバイスの両方で発生します。