Do I need to include @synthesize?

2019-06-18 05:14发布

I created a @property by right-clicking and dragging from ViewController.xib into ViewController.h, but @synthesize is not being automatically created in ViewController.m.

This post said that @synthesize is no longer necessary, but I'm wondering if auto-complete needs @synthesize for it to work correctly.

Q: Do I need to include @synthesize?

3条回答
女痞
2楼-- · 2019-06-18 06:00

In a word, no. Xcode 4.5 is fully aware of the fact that @synthesize is no longer required. You're good to go without!

查看更多
乱世女痞
3楼-- · 2019-06-18 06:03

When using ARC @synthesize auto appears. outside ARC you have to add it. Adrian

查看更多
爷的心禁止访问
4楼-- · 2019-06-18 06:12

Yes, you are good to go but make sure you specify it like this: self.textInput.text=@"Hello world" Without the self it is not recognized.

查看更多
登录 后发表回答