Graphics Programs Reference
In-Depth Information
The Completion Shortcut field in the edit window shows you what to type in a source file
to have Xcode add the snippet. 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.
You can't edit any of the pre-defined code snippets, but you can create your own. In
ItemsViewController.m , 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.
One issue with this snippet is that the return statement is really specific to this application
- it would be much more useful if the value returned was a code completion placeholder
that you could fill in easily. In the edit window, modify the code snippet so it looks like
this:
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
Search WWH ::




Custom Search