首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >细胞双细胞UITableview

细胞双细胞UITableview
EN

Stack Overflow用户
提问于 2019-04-02 12:17:51
回答 1查看 71关注 0票数 0

我想和DeviceTableViewCell一起使用TDBadgedCell的经典作品。我们怎么才能把这两个家族结合起来?例如,cellBadgedCell类.I希望在单元格类中使用badgeString。这将是我在代码中展示的方式

代码语言:javascript
复制
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {    
    return items.count
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    var cellBadgedCell = tableView.dequeueReusableCell(withIdentifier:"BadgedCell") as? TDBadgedCell;

    if(cellBadgedCell == nil) {
        cellBadgedCell = TDBadgedCell(style: .default, reuseIdentifier: "BadgedCell");
    }

    cellBadgedCell?.badgeString = demoItems[indexPath.row]["badge"]! 
    cellBadgedCell.badgeColor = .orange

    let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! DeviceTableViewCell
    return cell
}

我想要的函数应该是这样:

代码语言:javascript
复制
cell?.badgeString = ıtems[indexPath.row]["badge"]!
cell.badgeColor = .orange
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-02 12:39:49

您可以定义类DeviceTableViewCell: TDBadgedCell,也可以使用badgeString和badgeColor

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55474620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档