0

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
}

}
4

1 回答 1

0

您尝试访问的这些属性未在当前类中声明。您必须首先创建一个“CountryCell”类型的变量,然后访问该类的属性。

于 2015-02-05T00:55:37.390 回答