Skip to content

Instantly share code, notes, and snippets.

@sgoodwin
Created November 19, 2012 19:57
Show Gist options
  • Save sgoodwin/4113451 to your computer and use it in GitHub Desktop.
Save sgoodwin/4113451 to your computer and use it in GitHub Desktop.
A new object emerges!
@protocol RWSSection
- (NSUInteger)numberOfObjects;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow:(NSInteger)row;
@end
@interface RWSStaticSection : NSObject<RWSSection>
@property(nonatomic, readonly) NSArray *items;
@end
@implementation RWSSection
- (id)init
{
self = [super init];
if(self){
_items = @[@"Help I'm trapped in the debugger!", @"No no, save me instead!"];
}
return self;
}
- (NSUInteger)numberOfObjects
{
return 2u;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRow:(NSInteger)row
{
static NSString *staticIdentifier = @"staticSectionCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:staticIdentifier];
cell.textLabel.text = self.items[row];
cell.detailLabel.text = @"I'm a static row!";
return cell;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment