Uitableview 如何在IOS 7中显示从1到阵列计数的数字?
如何在表行中显示从1到数组计数的数字 我使用下面的代码Uitableview 如何在IOS 7中显示从1到阵列计数的数字?,uitableview,ios7,Uitableview,Ios7,如何在表行中显示从1到数组计数的数字 我使用下面的代码 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentif
- (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];
// NSInteger WeekList=[WeekArry count];
}
NSInteger row = indexPath.row;
cell.textLabel.text=[NSString stringWithFormat:@"Week %ld",(long)row];
NSLog(@"row%ld",(long)indexPath.row);
// Configure the cell...
return cell;
}
您只想从0打印到数组计数?tableView:numberOfRowsInSection:返回什么?
if (row == array.count) {
cell.textLabel.text=[NSString stringWithFormat:@"Week %ld",(long)row];
}else{
cell.textLabel.text=[NSString stringWithFormat:@"Week %ld",(long)row + 1];
}