スクロール中に非常に遅くなるUITableViewがあります。私のコードスニペットは次のとおりです。
私の「cellsetupCell」には、セルのコンテンツビューに追加したいくつかのカスタマイズされたアイテムがあります
1 X UIImageView
3 X UILabels
3つのXボタン(UIControlのサブクラス)
私の最初のテストでは、ラグの原因となっているボタンを指摘しているようです。ボタンクラスにチェックがあります
これらのチェックは非常に単純で基本的な操作であるように思われたため、ラグの原因が正確に何であるかはわかりません。誰かが通常そのような遅れを引き起こすものについて何かアドバイスがありますか?
編集:コードを追加
アプリを最初に起動したときはスクロールがスムーズでしたが、テーブルを何度も上下にスクロールすると、スクロールが遅くなりました。私のコードは次のとおりです。
if (cell == nil)
{
cell = [[[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:PlaceholderCellIdentifier] autorelease];
//Add like button
UICustomButton *likeButton = [[UICustomButton alloc]init];
likeButton.tag = 7;
//Add comment button
UICustomButton *commentButton = [[UICustomButton alloc]init];
commentButton.tag = 8;
//Add answer too button
UICustomButton *answerButton = [[UICustomButton alloc]init];
answerButton.tag = 9;
[self.contentView addSubview:likeButton];
[self.contentView addSubview:commentButton];
[self.contentView addSubview:answerButton];
[likeButton release];
[commentButton release];
[answerButton release];
}
//Set like button
UICustomButton *thisLikeButton = (UICustomButton *)[self.contentView viewWithTag:7];
[thisLikeButton setButtonWithAnswer:self.answerForCell buttonType:@"like" navcon:self.navcon andFrame:CGRectMake(CELL_TEXT_LEFT_MARGIN, totalCommentLabelHeight + CELL_SPACING*4, 45, CELL_BUTTON_HEIGHT)];
thisLikeButton.imageView.image = [UIImage imageNamed:@"heart.png"];
//Set comment button
UICustomButton *thisCommentButton = (UICustomButton *)[self.contentView viewWithTag:8];
[thisCommentButton setButtonWithAnswer:self.answerForCell buttonType:@"comment" navcon:self.navcon andFrame:CGRectMake(CELL_TEXT_LEFT_MARGIN + 45 + 5, totalCommentLabelHeight + CELL_SPACING*4, 80, CELL_BUTTON_HEIGHT)];
thisCommentButton.imageView.image = [UIImage imageNamed:@"chat.png"];
//Set answer button
UICustomButton *thisAnswerButton = (UICustomButton *)[self.contentView viewWithTag:9];
[thisAnswerButton setButtonWithAnswer:self.answerForCell buttonType:@"join in" navcon:self.navcon andFrame:CGRectMake(1.5*CELL_TEXT_LEFT_MARGIN + 45 + 5 + 80 + 5, totalCommentLabelHeight + CELL_SPACING*4, 60, CELL_BUTTON_HEIGHT)];
thisAnswerButton.imageView.image = [UIImage imageNamed:@"beer-mug_white.png"];
機器をチェックしましたが、コードのこの部分に多くのリークがないようです。
一連のスクロール後の遅延の原因は何であるかを誰かにアドバイスできますか?