我有朋友列表中的NSArray
上viewdidload
,然后我有一个定制的表视图 每个小区由一个Lable
,我想显示在表视图细胞在Lable
数组元素。如何在tableview上显示nsarray对象?
我的代码
tableList1 = [[NSArray
alloc]initWithObjects:@"Harendra",@"Satyendra",@"Jitendra",@"Sandeep",@"Dick",@"nihyan",@"alex
",@"Gorav",nil];
和
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// ******** LableView *******
UILabel* cellLabel = [[UILabel alloc] initWithFrame:CGRectMake(200,12, 141, 111)];
cellLabel.textColor=[UIColor greenColor];
cellLabel.font=[UIFont boldSystemFontOfSize:18];
//cell.textLabel.text = [callDetailArray objectAtIndex:indexPath.row];
cell.textLabel.text =[tableList1 objectAtIndex:indexPath.row];
// cellLabel.text =[NSArray arrayWithArray:tableList];
cellLabel.text = @"Lorem Ipsum";
cellLabel.backgroundColor = [UIColor clearColor];
cellLabel.opaque = NO;
[cell.contentView addSubview:cellLabel];
NSLog(@" arr count in Friends list %i",tableList1.count);
什么是你的问题,在这个代码? –
我有一个NSArray的朋友列表viewdidload,然后我有一个自定义的表视图每个单元格包含一个Lable,我想显示在表格视图单元格中的数组元素。 所以我该怎么做?请建议我 –
我想显示在表格视图单元格中的数组元素,请注意我想显示在单元格上的标签 –