테두리 색을 추가하고 그림자를 내 UITableViewCell 배경에 추가하는 코드는 다음과 같습니다. 내 문제는이 코드는 tableView 자체에 큰 지연을 일으키는 것입니다.그림자 및 테두리로 인한 UITableView 뒤틀림
내 코드를 최적화하여 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];
}
정확하게 그림자를 추가 하시겠습니까? UITableView 데이터 소스에서 그렇게 할 수 있습니까? 그렇다면 실제로 사용자 정의 UITableViewCell 서브 클래스를 만들고 거기에서 사용자 정의 UI를 수행해야합니다. –
죄송합니다. cellForRowAtIndexPath 메소드에 해당 사항이 없습니다. –