Why can’t I access the _ attribute when I rewrite the getter and setter methods at the same time? How can I rewrite the getter and setter methods at the same time? Please help me!
我想大声告诉你2017-05-02 09:26:48
This will indeed prompt an error, you need to add a line:
@synthesize city = _city;
漂亮男人2017-05-02 09:26:48
After encapsulation, attributes can only be accessed through the encapsulation method. Change _city to self.city. I don’t know if that’s right