2012-11-11 3 views
1

정적 인 tableview에 스토리 보드를 사용하고 있습니다. 모두 잘 작동합니다!Storyboard가있는 사용자 정의 된 정적 TableView - 셀 배경

이제 표보기 셀을 사용자 정의하고 싶습니다.

그래서 tableViewController를 추가하고 스토리 보드보기에 연결합니다. 여기 내가 사용자 정의 사용하고있는 코드입니다 :

-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

    // Configure the cell... 

    UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.0 blue:0.0 alpha:0.0]; 

    cell.detailTextLabel.backgroundColor = color; 

    cell.textLabel.backgroundColor = color; 

    cell.backgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbackground.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0]]; 
    cell.selectedBackgroundView = [ [UIImageView alloc] initWithImage:[ [UIImage imageNamed:@"cellbackground_down.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:5.0]]; 

    return cell; 
} 

하지만 이제 응용 프로그램을 실행하는 경우,

몇 가지 좀 도와 줄래 ... 테이블 뷰는 비어 있고 더 정의 배경이 없다? =)

Laurenz

답변

0

당신의 tableview:static 세포 & 동적 프로토 타입의 세포를 설정하는 방법은 두 가지가 있습니다. 실제로 정적 셀 모드의 경우 IB에서 직접 셀의 배경색을 설정할 수 있습니다. numberOfRowsInSectioncellForRowAtIndexPath

: 당신이 당신의 셀을 사용자 정의 할 수 cellForRowAtIndexPath 방법을 사용하려면

, 당신은 같은 모든 비 선택적인 방법을 구현해야합니다

관련 문제