Last active
December 10, 2015 15:38
-
-
Save anthonycvella/4455336 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#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 |
This file contains hidden or 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
#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