2013-11-11 2 views

ответ

0

вы можете добавить создать UIButton и добавить их в клетки, как subView в cellForRowAtIndexPath: метод. Вы можете subClass UITableViewCell и в методе init создать UIButton и добавить в subView. Вы также можете создавать ячейки через xib и загружать их динамически. Учебное пособие по настройке UITableViewCellhttp://www.appcoda.com/ios-programming-customize-uitableview-storyboard/

0

Это полностью зависит от вашего кодирования. Вам нужно написать логику для Tableview ячейки в методе, как: -

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

     UILabel *lblTeam = (UILabel*)[cell viewWithTag:321]; 
     UILabel *lblCRank = (UILabel*)[cell viewWithTag:258]; 
     UILabel *lblPRank = (UILabel*)[cell viewWithTag:369]; 

*// You can set the CGRectMake co-ordinates using variable like CGRectMake((x+12), (y+3), 120, 15); below * 

     if(!lblTeam){ 
      lblTeam = [[UILabel alloc]initWithFrame:CGRectMake(110, 52, 120, 15)]; 
      lblTeam.backgroundColor = [UIColor clearColor]; 
      lblTeam.textColor = [UIColor colorWithRed:103/255.0 green:103/255.0 blue:103/255.0 alpha:1.0]; 
      lblTeam.tag = 321; 
      lblTeam.font = [UIFont fontWithName:@"Futura-Medium" size:12.0]; 
      [cell addSubview:lblTeam]; 
      [lblTeam release]; 

      lblCRank = [[UILabel alloc]initWithFrame:CGRectMake(110, 19, 150, 25)]; 
      lblCRank.backgroundColor = [UIColor clearColor]; 
      lblCRank.textColor = [UIColor colorWithRed:245/255.0 green:168/255.0 blue:0/255.0 alpha:1.0]; 
      lblCRank.tag = 258; 
      lblCRank.font = [UIFont fontWithName:@"Futura-Medium" size:14.0]; 
      [cell addSubview:lblCRank]; 
      [lblCRank release]; 

      lblPRank = [[UILabel alloc]initWithFrame:CGRectMake(187, 20, 40, 25)]; 
      lblPRank.backgroundColor = [UIColor clearColor]; 
      lblPRank.textColor = [UIColor colorWithRed:245/255.0 green:168/255.0 blue:0/255.0 alpha:1.0]; 
      lblPRank.tag = 369; 
      lblPRank.font = [UIFont fontWithName:@"Futura-Medium" size:12.0]; 
      [cell addSubview:lblPRank]; 
      [lblPRank release]; 

     } 
     //Set the values of the labels or buttons here- 
     [lblPRank setText:@""]; 
     [lblCRank setText:@""]; 
     lblTeam.text = [countryName uppercaseString]; 
     return cell; 
    } 

Если вы до сих пор никаких проблем, показать нам свой код, который вы пытаетесь мы можем помочь вам намного лучше тогда.

Смежные вопросы