创建一个可重用的UITableViewCell代码

来源:互联网 发布:农行总行待遇 知乎 编辑:程序博客网 时间:2024/05/19 09:03
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    //1.创建cell    static NSString *ID = @"cell";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];    if (cell == nil) {        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];    }        //2.设置cell的数据    cell.textLabel.text = @"哈哈";            return cell;}

0 0
原创粉丝点击