2011-09-22 7 views

답변

2

당신은이 같은 jQuery과 대리자 메서드에서 셀의 색상을 변경할 수 있습니다

- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    UITableViewCell *cell = [tableView 
       dequeueReusableCellWithIdentifier:@"UITableViewCell"]; 

    if (!cell) {   
     cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle 
             reuseIdentifier:@"UITableViewCell"]autorelease]; 
    } 
} 

// 여기 // 당신이

을 원하는 무엇이든 사용하여 셀의 색상/배경 드 변경할 수 있습니다 색상을 변경합니다

:

[cell setBackgroundColor:[UIColor blackColor]]; 

는 셀의 배경 이미지를 변경 //

}

+0

감사를 언급하지만 어떻게 내가 탐색 모음의 색상을 변경하는 것처럼? 인터페이스 빌더에 추가하지 않았습니다. 그것은 프로그램 적으로 만들어졌습니다. –

+0

UINavigationController * myNavController; myNavController.navigationBar.tintColor = [UIColor redColor]; –

+0

정확히 내가 무엇을 찾고 있었습니까. 난 그냥 내 애플 리케이션 delegate.m에 넣어, 그리고 완벽하게 일했다. 감사! –

0

셀의 색을 변경하려면 UITableViewCell의 고유 한 하위 클래스를 만들어야합니다. 그리고 탐색 모음의 배경색을 변경하는, 나는 그것이라고 생각

self.navigationItem.backgroundColor = [UIColor redColor]; 

감사합니다,

macintosh264

0

당신은 테이블에 backgroundView을 설정하고의있는 contentView의 backgroundColor로하면됩니다 세포. 시작하려면 this을 참조하십시오. 탐색 막대는 UINavigationBar를 서브 클래스 화하고 drawRect 메소드를 대체하여 수행 할 수 있습니다.

P.S : 위의 모든 내용은 웹 및 스택 오버플로 자체에서 자습서가 산재 해있는 기본 항목입니다. 검색하고 읽으십시오.

0

노트 당신이

  • (있는 UITableViewCell *)있는 tableView의 셀 배경 색상을 설정하지 ios3의 같은 : (jQuery과 *)있는 tableView cellForRowAtIndexPath : (NSIndexPath *) indexPath

당신은

  • (무효) tableVie에서 설정 W : (jQuery과 *)있는 tableView willDisplayCell : (있는 UITableViewCell *) 세포 forRowAtIndexPath : (NSIndexPath *) indexPath

여기

http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html

관련 문제