开发者

xcode4 quickly add delegate protocol methods to a .m

In Xcode 4.x is there a way to quickly add method stubs for a delegate or dataSourceDelegate?

Right now if I'm adding an UI component like a UI picker view I need to lookup the protocol in the header and then create those methods.

Is there some handy way of saying add the required and optional stubs to my .m for a given delegate protocol? Without translating copy+paste and adapt from the protocol declaration.

This SO question What is the most efficient way in XCode to add a delegate's or protocol's methods to the .m file? talks about cut and paste from Xcode3 and that's always how I've done it but I'm开发者_运维技巧 wondering if there is a slicker approach in Xcode4.


You could create your own stubs and add them to Xcode's Code Snippet pane. To create a new snippet, highlight the relevant section of your code, and click and drag into the code snippets pane. Then to use them, simply drag and drop snippets into your code. I've heard you can set a completion prefix too so that the snippet will come up in autocomplete.

xcode4 quickly add delegate protocol methods to a .m

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜