我有朋友列表中的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,我想顯示在表格視圖單元格中的數組元素。 所以我該怎麼做?請建議我 –
我想顯示在表格視圖單元格中的數組元素,請注意我想顯示在單元格上的標籤 –