Skip to content

Instantly share code, notes, and snippets.

@anthonycvella
Last active December 10, 2015 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonycvella/4455336 to your computer and use it in GitHub Desktop.
Save anthonycvella/4455336 to your computer and use it in GitHub Desktop.
#import "ResourcesTableViewController.h"
@interface ResourcesTableViewController ()
@end
@implementation ResourcesTableViewController
@synthesize resourceCategories;
- (id)initWithStyle:(UITableViewStyle)style
{
self = [super initWithStyle:style];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Create resource category table data
//resourceCategories = [NSArray arrayWithObjects:@"Weapons", @"Ammunition", @"Backpacks", "@Consumables", @"Equipment", @"Attachments", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [resourceCategories count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *resourceTableIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:resourceTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:resourceTableIdentifier];
}
cell.textLabel.text = [resourceCategories objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"table_cell.png"]];
}
@end
#import <UIKit/UIKit.h>
@interface ResourcesTableViewController : UITableViewController
@property (strong, nonatomic) NSArray *resourceCategories;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment