我想创建一个插入单元accesoryView中的badgeView.我知道过去曾经有过很多这样的问题,但那些github子类似乎已经过时,无法移植到一个快速的项目中.在快速项目中,在IOS中最简单的方法是什么?
像这样的东西:

我正在尝试将多个子类添加到UITableView中.问题是它一直给我以下错误:
Type UITableVieCell does not conform to protocol NilLiteralConvertible
Run Code Online (Sandbox Code Playgroud)
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
cell.textLabel?.text = self.section1[indexPath.row]
cell.accessoryType = .DisclosureIndicator
return cell
} else if indexPath.section == 1 {
let cell = tableView.dequeueReusableCellWithIdentifier("SwitchViewCell", forIndexPath: indexPath) as SwitchViewCell
cell.cellLabel?.text = self.section2[indexPath.row]
return cell
}
return nil
}
Run Code Online (Sandbox Code Playgroud)