first

来源:互联网 发布:net域名后缀排名高吗 编辑:程序博客网 时间:2024/03/28 20:43
#pragma mark 数据源协议//返回第section组有多少行- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {    return 6;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {    //TableViwe重用机制。不在屏幕内的cell回收重用        //从重用队列中取可用的cell    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"id"];        //如果重用队列中没有可重用色    if (cell == nil) {        //实例化一个cell        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"id"];    }    //设置cell的文字    cell.textLabel.text = @"一二三";    //设置图片    if (indexPath.row < 5) {        cell.imageView.image = [UIImage imageNamed:@"1.png"];    }    else {        cell.imageView.image = nil;    }    return cell;    }

0 0
原创粉丝点击