Created
May 31, 2012 14:27
-
-
Save gose/2843730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MyViewController.m | |
// | |
#import <QuartzCore/QuartzCore.h> | |
#import "MyViewController.h" | |
#import "MBProgressHUD.h" | |
#import "Query.h" | |
#import "QueryResponse.h" | |
@interface MyViewController () | |
{ | |
MBProgressHUD *hud; | |
} | |
- (QueryResponse *)queryServiceWithQuery:(Query *)query; | |
@end | |
@implementation MyViewController | |
@pragma mark - Accessor methods | |
@synthesize *resultsTable; | |
@pragma mark - Parent methods | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
hud = [[MBProgressHUD alloc] initWithView:self.view]; | |
[self.view addSubview:hud]; | |
} | |
@pragma mark - Public methods | |
- (IBAction)reload:(id)sender | |
{ | |
// reload: | |
} | |
@pragma mark - Private methods | |
- (QueryResponse *)queryServiceWithQuery:(Query *)query | |
{ | |
// queryServiceWithQuery: | |
} | |
@pragma mark - UITableViewDataSource methods | |
... | |
@pragma mark - UITableViewDelegate methods | |
... | |
@end |
Interesting Randy, I think I'm going to adopt that practice since it's even more explicit. Thanks for the feedback.
##
Scott Gose
gose@me.com
…On May 31, 2012, at 11:34 AM, Randy Becker wrote:
The only thing I do differently is specifying which superclass defines a method that I override, e.g. `#pragma mark NSObject Methods`, and I also add "Protocol" to the pragmas for protocols, e.g. `#pragma mark NSObject Protocol Methods`
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2843730
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's my best practice for organizing obj-c classes; particularly, the #pragma mark directives. They are quite useful for calling up the "Show Document Items" keyboard shortcut and knowing generally where to look for a method. That shortcut is mapped to ctrl-6 by default, but I have it remapped to ctrl-d for convenience.
For the delegate methods, I use their formal name so option-clicking them pulls up their documentation.
Do you have a better or different way? Let me know!