Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return departments.count;
- }
- #import "TableViewController.h"
- #import "MasterViewController.h"
- @interface TableViewController ()
- @end
- @implementation TableViewController
- @synthesize selectionH;
- @synthesize departments;
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- if (selectionH==0){
- departments = [NSMutableArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", nil];
- }
- else if (selectionH == 1){
- departments = [NSMutableArray arrayWithObjects:@"A", @"B", @"C", @"D", @"E", nil];
- }
- else{
- departments = [NSMutableArray arrayWithObjects:@"Red", @"Green", @"Yellow", @"Blue", nil];
- }
- }
- - (void)insertNewObject:(id)sender {
- [departments insertObject:[NSDate date] atIndex:0];
- NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
- [self.tableView insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return 1;
- }
- //vCausing Issue
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return departments.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
- NSDate *object = departments[indexPath.row];
- cell.textLabel.text = [object description];
- return cell;
- }
- @end
- #import <UIKit/UIKit.h>
- @interface TableViewController : UITableViewController
- @property (strong, nonatomic) id detailItem;
- @property int selectionH;
- @property NSMutableArray * departments;
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement