-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up View Controllers, setup the HomeViewController, remove some …
…unused ViewControllers
- Loading branch information
Casing Chu
committed
Feb 19, 2015
1 parent
a025ce6
commit 7f3e950
Showing
18 changed files
with
406 additions
and
457 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// HomeViewController.h | ||
// unnamed | ||
// | ||
// Created by Casing Chu on 2/18/15. | ||
// Copyright (c) 2015 com.yahoo. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface HomeViewController : UIViewController | ||
|
||
@end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// | ||
// HomeViewController.m | ||
// unnamed | ||
// | ||
// Created by Casing Chu on 2/18/15. | ||
// Copyright (c) 2015 com.yahoo. All rights reserved. | ||
// | ||
|
||
#import "HomeViewController.h" | ||
#import "SurveyCell.h" | ||
|
||
NSString * const kSurveyCell = @"SurveyCell"; | ||
|
||
@interface HomeViewController () <UITableViewDelegate, UITableViewDataSource> | ||
@property (weak, nonatomic) IBOutlet UITableView *tableView; | ||
@property (nonatomic, strong) UIRefreshControl *tableRefreshControl; | ||
|
||
@property (nonatomic,strong) NSMutableArray *surveys; | ||
|
||
@end | ||
|
||
@implementation HomeViewController | ||
|
||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | ||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | ||
if (self) { | ||
self.title = @"Home"; | ||
self.tabBarItem.image = [UIImage imageNamed:@"Home"]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
// Setup Objects | ||
self.surveys = [[NSMutableArray alloc] init]; | ||
|
||
// Table Refresh control | ||
self.tableRefreshControl = [[UIRefreshControl alloc] init]; | ||
[self.tableRefreshControl addTarget:self action:@selector(onTableRefresh) forControlEvents:UIControlEventValueChanged]; | ||
[self.tableView insertSubview:self.tableRefreshControl atIndex:0]; | ||
|
||
// TableView Setup | ||
self.tableView.dataSource = self; | ||
self.tableView.delegate = self; | ||
[self.tableView registerNib:[UINib nibWithNibName:kSurveyCell bundle:nil] forCellReuseIdentifier:kSurveyCell]; | ||
self.tableView.rowHeight = UITableViewAutomaticDimension; | ||
} | ||
|
||
- (void)didReceiveMemoryWarning { | ||
[super didReceiveMemoryWarning]; | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
#pragma mark - RefreshControl | ||
- (void)onTableRefresh { | ||
NSLog(@"onTableRefresh"); | ||
[self.tableRefreshControl endRefreshing]; | ||
} | ||
|
||
#pragma mark - TableViewDelegate Methods | ||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
return self.surveys.count; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
SurveyCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kSurveyCell]; | ||
return cell; | ||
} | ||
|
||
- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
return UITableViewAutomaticDimension; | ||
} | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
[tableView deselectRowAtIndexPath:indexPath animated:YES]; | ||
} | ||
|
||
@end |
Oops, something went wrong.