I have two labels (CountryCode, CountryName) in prototype cells, and I created a class for them called " CountryCell " and I created the TableViewController class called " CountriesVC " I made the labels' outlets in the CountryCell but I want to use them in CountriesVC and when I do so it reports an error that says 'CountriesVC' Does not have a member named 'CountryCode' .
Thanks a lot.
Here is the code where I want to use CountryCode and CountryName
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "ChangeCountryCode" {
SelectedCCode = self.CountryCode.text
SelectedCName = self.CountryName.text
}
}
Here is CountryCell code :
class CountryCell: UITableViewCell {
@IBOutlet weak var CountryCode: UILabel!
@IBOutlet weak var CountryName: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
These properties that you are trying to access are not declared in the current class. You must first create a variable of type "CountryCell" and then access the properties of that class.