4

This seems like an obvious feature that should be there but i can't find it.

For example if my class is a uitableviewdelegate whats the quickest way for me to see all the available delegate methods and add the ones im interested in to my implementation file?

asked Sep 13, 2011 at 17:03
2

1 Answer 1

2

You can use the tip in the first link that Simon posted above to get the method signatures for a delegate. After that, adding the code is up to you.

What I like to do is to choose the delegate methods that I most often use, and add them to a code snippet.

For example, for UITableViewDatasource I have a snippet called "UITableView Datasource Required Methods" containing:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 static NSString *cellIdentifier = @"myCellName";
 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
 if (cell == nil) {
 cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:cellIdentifier] autorelease];
 }
 //customize cell before showing it
 return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 return <#numRow#> ;
}

Then I drag that snippet into my code whenever I'm creating a table delegate.

answered Sep 22, 2011 at 21:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.