2011-08-24 3 views
2

enter image description here스타일 테이블

세포마다 작은 세포가 다른 페이지를 트리거하기 위해 클릭 할 수있는 내부 테이블이 이런 종류의를 구현하는 방법.

+0

'UIButton's – visakh7

+0

을 포함하는 사용자 정의 셀을 만들어보십시오. 한 UIImageView (두 줄)와 네 개의 레이블 (숫자) 및 네 개의 버튼 (단어가 링크 인 경우)이있는 하나의 UITableViewCell. :) – Bonny

답변

0

트위터 앱처럼 보입니다.

내가 생각

,이 방법은 당신을 도울 수 있습니다

  • 가 번호 및 텍스트 2 레이블이있는 UIView 만들기; 그것은 labelView
  • 추가 버튼을 [UIButton alloc] buttonWithType: UIButtonTypeCustom]
  • 를 확인 이름을 당신이 버튼의 하위 뷰 등 lableView. 수동으로 적절한 위치에 버튼을 이동 한 후

    labelView.layer.borderSize = 1;

    labelView.layer.borderColor = [UIColor grayColor].CGColor;

  • , #import <QuartzCore/QuartzCore.h> 다음 구분자를 만들려면 측면

  • 나란히 :

  • 은 2 버튼 셀을합니다. 다음을 사용하실 수도 있습니다 : cell.contentView.clipsToBounds = YES

희망이 도움이됩니다.

0
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 
    return 10; 
} 

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

    UIButton* tempBtn1;  
    UIButton* tempBtn2;  

    if(cell == nil) 
    { 
     cell = (UITableViewCell*) [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier]; 

     tempBtn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     tempBtn1.tag = 123; 
     tempBtn1.frame = CGRectMake(0, 0, 160, 44); 
     [tempBtn1 setTitle:@"firstBtn" forState:UIControlStateNormal]; 
     [cell.contentView addSubview:tempBtn1]; 

     tempBtn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     tempBtn2.tag = 234; 
     tempBtn2.frame = CGRectMake(160, 0, 160, 44); 
     [tempBtn2 setTitle:@"secondBtn" forState:UIControlStateNormal]; 
     [cell.contentView addSubview:tempBtn2];  
    } 
    else { 
     tempBtn1 = (UIButton*)[cell.contentView viewWithTag:123];  
     [cell.contentView addSubview:tempBtn1];   
     tempBtn2 = (UIButton*)[cell.contentView viewWithTag:234];  
     [cell.contentView addSubview:tempBtn2];  
    } 

    return cell; 
} 
0

UIView 하위 클래스를 만듭니다. 이것은 하나의 항목 (셀 내용의 1/2)을 나타냅니다. 각 셀에 두 가지를 추가하십시오. 이 UIView 서브 클래스에서 터치를 감지하고 터치 이벤트가 발생하면 새 ViewController를 푸시합니다.

관련 문제