ios - Swift: IBoutlet always returns nil object? -
I have UITablesView with its nib file with custom UItableViewCell
function table view (Table View: UITableView !, CellphoneRouthindex Text Index: NSIndexPath!) - & gt; UITableViewCell! {To cell = tableView.dequeueReusableCellWithIdentifier (quoteCellIdentifier, forIndexPath: indexPath) DynamicTableViewCell if (cell == null) {println ( "not started")} println (cell) println (cell.scenarioLabel) return} as cell Console / p & lt; _TtC17Dynamic_Cell_Demo20DynamicTableViewCell: 0xb291a70; BaseClass = UITableViewCell; Frame = (0; 320 44); Layer = & lt; CALayer: 0xb291e40 & gt; & Gt; To be able to: null Custom UITableViewCell
class DynamicTableViewCell: UITableViewCell {@IBOutlet bridesmaid scenarioLabel: UILabel @IBOutlet bridesmaid quoteContentLabel: UILabel Connection
I think you are not registered in tableview nib, - viewDidLoad Swift:
tableView.registerNib (UINib (nibName: "DynamicTableViewCell", Bundle: zero), forCellReuseIdentifier: quoteCellIdentifier) Objective-C:
[self.tableView registerNib: [UINib nibWithNibName: @ "DynamicTableViewCell" bundle: nil]] forCellReuseIdentifier: quoteCellIdentifier];
Comments
Post a Comment