UITableViewCell の背景に境界線の色とドロップ シャドウを追加する次のコードがあります。私の問題は、このコードが tableView 自体に大きな遅延を引き起こすことです。
UITableView の遅延を防止してコードを最適化する方法を教えてください。
if ([cell viewWithTag:012] == nil && comment.isReply == NO) {
UIImageView *iv = [[[UIImageView alloc] initWithFrame:frame] autorelease];
[iv setImage:[UIImage imageNamed:@"paper"]];
[iv setTag:012];
[cell insertSubview:iv atIndex:0];
[iv.layer setBorderWidth:1.0];
[iv.layer setBorderColor:[[UIColor whiteColor] CGColor]];
[iv.layer setShadowColor:[[UIColor blackColor] CGColor]];
[iv.layer setShadowOffset:CGSizeMake(0, 1)];
[iv.layer setShadowOpacity:0.75];
}
else if ([cell viewWithTag:012] == nil && comment.isReply == YES) {
frame.origin.x += 35;
UIImageView *iv = [[[UIImageView alloc] initWithFrame:frame] autorelease];
[iv setImage:[UIImage imageNamed:@"paper"]];
[iv setTag:012];
[cell insertSubview:iv atIndex:0];
UIImage *arrow = [UIImage imageNamed:@"arrow"];
UIImageView *ivs = [[[UIImageView alloc] initWithFrame:CGRectMake(-12, ([cell frame].size.width / 2) + ([arrow size].width/2) , arrow.size.width, arrow.size.height)] autorelease];
[cell addSubview:ivs];
[iv.layer setBorderWidth:1.0];
[iv.layer setBorderColor:[[UIColor whiteColor] CGColor]];
[iv.layer setShadowColor:[[UIColor blackColor] CGColor]];
[iv.layer setShadowOffset:CGSizeMake(0, 0)];
[iv.layer setShadowOpacity:0.75];
}