UITableViewCell
에 배경 이미지를 추가하려고합니다. 받는 사람 변경 얻을 것이다 응용 프로그램을 실행하고있는 tableview를 선택하는 동안UITableViewCell 배경 이미지 설정
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"TableCell";
// Dequeue or create a cell of the appropriate type.
TableCell *cell = (TableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell.backgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbg.jpeg"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbg.jpeg"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0] ];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
[cell.preparationLabel setFont:[UIFont fontWithName:@"Bold" size:20]];
// Configure the cell.
if (btnselected==1)
{
cell.preparationLabel.text = [recipe.ingredients objectAtIndex:indexPath.row];
}
else
{
cell.preparationLabel.text = [recipe.preparation objectAtIndex:indexPath.row];
}
return cell;
}
내 문제가있다, 먼저 기본 흰색 배경 및 시간 셀 배경 후 테이블 셀을 보여줍니다 이 내가 사용하고있는 코드입니다 욕망 이미지 ... 왜 내가 원하는 셀 배경으로 테이블 뷰를로드하는 데 오랜 시간이 걸리는지 알 수 없다.
참조 http://stackoverflow.com/a/15353155/1713478 그것은 당신을 도울 것입니다 답변 – Pratik