nivea
nivea

Reputation: 47

Access Views inside custom UITableViewCell in iOS

I have a UITableView which is populated by the cells coming from another XIB file. How can I access the views (eg. label) of the cell inside didSelectRowAtIndexPath method of tableView?

Upvotes: 2

Views: 985

Answers (1)

Bannings
Bannings

Reputation: 10479

Use cellForRowAtIndexPath:

let cell = tableView.cellForRowAtIndexPath(indexPath) as! YourCustomCell

then you can access its label:

cell.customLabel.text = "test"

Upvotes: 3

Related Questions