Is there a shortcut for adding properties in Xcode 4?
In Visual Studio if I type prop
and press tab then a property is created for me, I just have to fill in the details. Is there anything like this in Xcode 4?
I realise that a similar question has been aske开发者_开发百科d here: Xcode script for generating/synthesizing properties but it seems to relate to Xcode 3 judging by the date.
Thanks, Gareth
In Xcode4 you can add a property, create an ivar, get release calls in dealloc and setting to nil in viewDidUnload all by simply dragging a UI component from within the XIB editor into your view controller's header file. All you have to do is name the property and Xcode4 does the rest for you. Nice!
Unfortunately if you just want to manually add a property, create an associated ivar and manage memory in an arbitrary class, there is no way to do that. At least none I have found so far! The smart code completion undeniably is an improvement but not the same as an intelligent operation to add all the boiler-plate for the addition of a property.
The code completion in Xcode 4 has been greatly improved. Just start typing @prop... and complete the in the header file. THen switch to your implementation file and start type @syn... and you are done.
精彩评论