2012-07-22 2 views
1

Storyboard에서 수행 된 4 개의 섹션에서 정적 셀을 가진 UITableView가 있습니다. 그러나 한 섹션 ([UIColor clearColor])에 대한 구분 기호 색을 변경하고 싶습니다. 내가 어떻게 할 수 있니? ??? 실제로 가능합니까?정적 셀이있는 UITableView - 섹션 당 구분 색상이 다릅니 까?

하나의 특정 섹션뿐만 아니라 전체 테이블에 대해 separatorColor를 clearColor로 설정할 수 있습니다. 테이블 뷰 부의

스크린 샷 :

Screenshot of table view section

답변

1

는 AFAIK 대한 방법이 없다. 하지만 하단에 분리 기호가있는 셀에 배경 이미지를 놓고 separator 스타일을 UITableViewCellSeparatorStyleNone으로 설정할 수 있습니다. 그래서 당신은 당신 자신의 구분 기호를 모든 셀에 가지고 있습니다.

+0

나는 iphonesdk.com 포럼에 질문하고 Manish915 나에게이 대답하고 /iphone-sdk-development/106224-uitablewiew-with-static-cell-different-separation-color-per-section.html – pprochazka72

+0

잘 모르겠지만 시도해 볼 수 있습니다. 어쨌든 cellForRowAtIndexPath 메서드는 다음과 같이 시작해야합니다 : static NSString * CellIdentifier = @ "Cell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier : CellIdentifier]; if (! cell) { cell = [[UITableViewCell alloc] initWithStyle : UITableViewCellStyleDefault reuseIdentifier : CellIdentifier]; } – Mert

0

아마도 섹션의 헤더 텍스트를 빈 문자열로 설정하여 목표를 달성 할 수 있습니다.

0

하나의 방법은 자신의 UIView 하위 클래스를 만들고 drawRect:에 사용자 지정 그림을 작성하는 것입니다. 이 뷰를 가져 와서 테이블 뷰 셀의 backgroundView으로 추가합니다. 이런 식으로 뭔가가 : 그것의 스크린 샷 그래서 나는 그것이 어려운해서는 안 추측 http://www.iphonedevsdk.com/forum을 부착도

- (void)drawRect:(CGRect)rect 
{ 
    [super drawRect:rect]; 
    // Drawing code 
    CGContextRef context = UIGraphicsGetCurrentContext(); 
    CGContextSetLineWidth(context, 1.0); 

    // Draw black line 
    CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); 
    CGFloat components[] = {0.0, 0.0, 0.0, 0.3}; 
    CGColorRef blackColor = CGColorCreate(colorspace, components); 

    CGContextSetStrokeColorWithColor(context, blackColor); 

    CGContextMoveToPoint(context, 0, rect.size.height - 1.5); 
    CGContextAddLineToPoint(context, rect.size.width, rect.size.height - 1.5); 
    CGContextStrokePath(context); 
    CGColorRelease(blackColor); 

    // Draw white bottom line 
    CGFloat whiteComponents[] = {1.0, 1.0, 1.0, 0.75f}; 
    CGColorRef whiteColor = CGColorCreate(colorspace, whiteComponents); 

    CGContextSetStrokeColorWithColor(context, whiteColor); 

    CGContextMoveToPoint(context, 0, rect.size.height - 0.5); 
    CGContextAddLineToPoint(context, rect.size.width, rect.size.height - 0.5); 
    CGContextStrokePath(context); 
    CGColorRelease(whiteColor); 

    // Draw top white line 
    CGFloat whiteTransparentComponents[] = {1.0, 1.0, 1.0, 0.45}; 
    CGColorRef whiteTransparentColor = CGColorCreate(colorspace, whiteTransparentComponents); 

    CGContextSetStrokeColorWithColor(context, whiteTransparentColor); 

    CGContextMoveToPoint(context, 0, 0.5); 
    CGContextAddLineToPoint(context, rect.size.width, 0.5); 
    CGContextStrokePath(context); 
    CGColorRelease(whiteTransparentColor); 



    CGColorSpaceRelease(colorspace); 
} 
관련 문제