2016-07-12 2 views
0

tableView에 테이블 세부 정보를 행과 열 형식으로 아래 그림과 같이 표시하려고합니다.ios에서 tableview에 대한 행 줄을 추가하는 방법

table image

나는 ViewControllerUITableView을 구현하고, 사용자 정의 셀을 추가하고 난 .Instead 내가 필요로하는 세포 사이의 공간을 원하는 그나마 지금

i have implemented

을 같이 데이터를 표시 한 이미지와 같이 셀 사이의 수직선. 여기

내 코드 내가 그것을 달성 할 수있는 방법

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

    AttendenceTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 
    AttendenceTableViewCell*cell=[[AttendenceTableViewCell alloc]init]; 
    if (cell == nil) { 
     cell = [[ AttendenceTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"]; 
    } 
    cell.textLabel.textColor=[UIColor colorWithRed:0.24 green:0.67 blue:0.94 alpha:1.0]; 
    _attendenceTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; 

    [email protected]"Date"; 
    [email protected]"in"; 
    [email protected]"out";; 
    [email protected]"duration"; 
    [email protected]"status"; 
    [spinner stopAnimating]; 
    return cell; 
} 

입니다 ...? 다른 레이블에 대한 1. 추가보기 :

+0

줄을 표시하는 스토리 보드에서보기를 사용할 수 있습니다. –

+0

나는 date, in, out, duration, status 사이에 구두를 신어야한다. – remyr3my

+0

나는 그 (것)들 사이에서 전망을 시도했다 그러나 서투르게 본다. – remyr3my

답변

2

, 당신이 당신의 init 메소드에 (이런 뷰 (프로그래밍 방식)을 추가 할 수는 AttendanceTableViewCell 당신에게

0

당신은 데이터 사이의 라인을위한 공간을

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return 45.0; 
} 

을 제거하기 위해 위임 방법으로 표 셀의 높이를 변경할 수 있습니다. 2.보기에 레이블을 추가하십시오. 3.보기의 배경색을 변경하십시오.

0

cellForRowAtIndexPath의 AttendenceTableViewCell * 셀에 UIImageView를 추가하십시오. 각 셀은 수직 라인이있을 것이다

0

도움이 될 것 같은 프로토 타입 셀 또는 사용자 정의 셀을하시기 바랍니다 또는 awakeFromNib에서) :

CGFloat lineWidht = 2.00; // <- set the line width 
UIColor *bgColor = [UIColor colorWithRed:200/255.0 green:199/255.0 blue:204/255.0 alpha:1.0]; 

CGRect horizontalLineFrame = CGRectMake(self.contentView.frame.size.width - lineWidht, 0, lineWidht, self.contentView.frame.size.height); 

UIView *horizontalLine = [[UIView alloc] initWithFrame:horizontalLineFrame]; 
horizontalLine.backgroundColor = bgColor; 
[self.contentView addSubview:horizontalLine]; 
관련 문제