I have an inner custom UITableViewCell class(class inside a class), I would like to use it on Interface Builder. However, it can't recognize it on it.
import UIKit
class ContactListViewController: UIViewController {
class Cell: UITableViewCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var phone: UILabel!
}
@IBOutlet weak var tableView: UITableView!
}
The configuration of above image didn't work. Is there a way to do it?
You need to specify objective c name for your nested class with @objc
then use it in the Interface Builder:
import UIKit
class ContactListViewController: UIViewController {
@objc(CLCell) class Cell: UITableViewCell {
@IBOutlet weak var name: UILabel!
@IBOutlet weak var phone: UILabel!
}
@IBOutlet weak var tableView: UITableView!
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.