您的位置:首页 > 移动开发 > IOS开发

iOS 开发-数组反向显示于 tableView。

2014-11-18 16:03 435 查看
效果类似 iOS 上的系统秒表功能下的 tableView 显示方式。

代码如下

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

static NSString *Identifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:Identifier];

if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:Identifier];
}

cell.textLabel.text = [self.timelist objectAtIndex:[self.timelist count]-indexPath.row-1];
return cell;
}


其中:

cell.textLabel.text = [self.timelist objectAtIndex:[self.timelist count]-indexPath.row-1];


为关键代码。

将对象下标设置为数组的数量减去位置下标减1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐