you can Add value from different array in different cell like bellow.. Also i add controls in UITableCell
for just an example which through you can add multiple controls in the cell with frame..
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier = @"gridCell";
UITableViewCell *yourCell = [tableView dequeueReusableCellWithIdentifier:nil];
if(yourCell == nil)
{
yourCell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
}
if(indexPath.row == 0)
{
yourCell.textLabel.text=[NSString stringWithFormat:@"%@",array];
UILabel *lbl = [[UILabel alloc]init];
lbl.text = [NSString stringWithFormat:@"%@",array];
lbl.font = [UIFont fontWithName:@"Helvetica-Bold" size:15];
[lbl setFrame:CGRectMake(110, 5, 200, 31)]; /// Set Frame which you want for every controls...
// you can also add UITextView,etc..
[yourCell.contentView addSubview:lbl];
UILabel *lbl2= [[UILabel alloc]init];
[lbl2 setFrame:CGRectMake(110, 31, 200, 31)];
lbl2.text = [NSString stringWithFormat:@"%@",array1];
lbl2.font = [UIFont fontWithName:@"Helvetica" size:12];
lbl2.textColor = [UIColor darkGrayColor];
[yourCell.contentView addSubview:lbl2];
}
else if(indexPath.row == 1)
{
yourCell.textLabel.text=[NSString stringWithFormat:@"%@",array1];
///ADD also Controls here if you want to in this cell also...or every cell also then write and add subview outside from this if condition
}
else if(indexPath.row == 2)
{
yourCell.textLabel.text=[NSString stringWithFormat:@"%@",array2];
}
return yourCell;
}
AND if you want to Add multiple line in one cell then just add UILable
or any other controls and set the frame and add as a subview of cell and also set height of the cell with bellow method…
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
//height of table row
return 80;///give the height to cell which you want here
}
8
solved Multiple Arrays in Multiple UITableViewCell [closed]