KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been teaching myself Objective-C for about 6 months and like using the language a lot. However I haven't found any good coding standards, so the code I write always ends up looking like an inconsistent mess. Things like naming conventions carry over just fine, but spacing, indentation and the (impossible?) 80 character line-width aren't working out so well. What conventions do you use with Objective-C? Here is a small example of something that isn't working: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self.parentViewController action:@selector(done:)] autorelease]; NSString* units = [[NSString alloc] initWithFormat:@"%@", @"oz"]; NSString* optionOne = [[NSString alloc] initWithFormat:@"[%d%@] Calculate", 100, units]; self.options = [[NSMutableArray alloc] initWithObjects: optionOne, @"Configure Portions", @"Configure Notifications", @"Help", nil]; [units release]; [optionOne release]; [tableView reloadData]; } return self; }
Tags (comma-separated)
Save Edits
Cancel