swift - Edit Style of UITableViewCell -
I want to add a new function to my MyTableView.swift file, but I get an error:
< Pre> Overriding method with selector 'initWithStyle: reuseIdentifier:' Incompatible Type '(UITableViewCellStyle, String) - & gt; MyTableViewCell '
This is the code that I want to add:
init (style: UITableViewCellStyle, ReuseIdentifier: String) {super.init (style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier)}
The code MyTableView.swift file:
import UIKit class MyTableViewCell: UITableViewCell {to medColor: UIColor = UIColor (red: 0.973; green: 0.388, blue: 0.173 Alpha: 1) {super.init (style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier)} awakeFromNib function overrides () {(: UITableViewCellStyle, reuseIdentifier string style) init super. AwakeFromNib () // Start Code} setSelected Function Override (Selected: Bull, Animated D: Boole) {super.setSelected (selected, animated: animated) // view configured for selected state}}
it says is not equal to (UITableView Selstail, string)
type (UITableViewCellStyle, string?)
If you UItableViewCell Init method looks like -
init (style: UITableViewCellStyle, reuseIdentifier: string)
OK
An alternative Chana reuseIdentifier type for string string
Code?> String
override the init (style: UITableViewCellStyle, reuseIdentifier: String) {super.init (style: UITableViewCellStyle.Subtitle, reuseIdentifier: reuseIdentifier)}
< / Pre>
Comments
Post a Comment