iOS programming Code Snippet Library

iOS programming  Code Snippet Library 

The freebie code comes from the code snippet library.

代码来自code snippet library。

Notice that there are a number of code snippets available

有许多code snippets available .

Click the Edit button on the code snippet detail window

点击Edit 按钮。

The Completion Shortcut field in the edit window shows you what to type in a source file to have Xcode add the snippet.

Completion ShortCut 告诉你输入什么将会有这个片段。这个里面是init 。

This window also tells you that this snippet can be used in an Objective-C file as long as you are in the scope of a class implementation.

还能告诉你这个片段能用在Objective-C文件中。且在类实现的范围内。

 

You cannot edit any of the pre-defined code snippets, but you can create your own.

你不能编辑所有预定义的code snippets,但是你能创建你自己的。

 

locate the implementation of tableView:numberOfRowsInSection:. Highlight the entire method:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return [[[BNRItemStore sharedStore] allItems] count];

}

 

Drag this highlighted code into the code snippet library. The edit window will appear again, allowing you to fill out the details for this snippet.

把选中的部分拖到code snippet library . edit window 将会再次显现。

In the edit window, modify the code snippet so it looks like this:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section

{
return <#number of rows#>;

}

posted @ 2015-05-12 09:34  巴山夜雨1989  阅读(187)  评论(0编辑  收藏  举报