example


//Storyboard

      


//source code


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

{

    static NSString *CellIdentifier = @"";

    

    if(indexPath.section == 0)

        CellIdentifier = @"RootCell";

    else if(indexPath.section == 1)

        CellIdentifier = @"Legend";

    else if(indexPath.section == 2)

        CellIdentifier = @"Cell";

    

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    if(cell == nil)

        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    

    if(indexPath.section == 0)

    {

        UIButton *refreshButton = (UIButton *)[cell.contentView viewWithTag:1];

        [refreshButton addTarget:self action:@selector(tableRefreshAction:) forControlEvents:UIControlEventTouchUpInside];

    }

    else if(indexPath.section == 1)

    {

        cell.textLabel.text = [legend_value objectAtIndex:[indexPath row]];

        //legend is NSMutableArray

    }

    else if(indexPath.section == 2)

    {

        cell.textLabel.text =  [obs_value objectAtIndex:[indexPath row]]

        //obs_value is NSMutableArray

    }

    return cell;

}


+ Recent posts