Do I need to include @synthesize?

允我心安 提交于 2020-01-03 10:58:41

问题


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?


回答1:


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!




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/13016117/do-i-need-to-include-synthesize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!