forked from danqing/2048
-
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.
- Loading branch information
Danqing
committed
Mar 26, 2014
1 parent
c4e3f26
commit bf38ed8
Showing
17 changed files
with
678 additions
and
65 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,16 @@ | ||
// | ||
// M2SettingsDetailViewController.h | ||
// m2048 | ||
// | ||
// Created by Danqing on 3/24/14. | ||
// Copyright (c) 2014 Danqing. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface M2SettingsDetailViewController : UITableViewController | ||
|
||
@property (nonatomic, strong) NSArray *options; | ||
@property (nonatomic, strong) NSString *footer; | ||
|
||
@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,73 @@ | ||
// | ||
// M2SettingsDetailViewController.m | ||
// m2048 | ||
// | ||
// Created by Danqing on 3/24/14. | ||
// Copyright (c) 2014 Danqing. All rights reserved. | ||
// | ||
|
||
#import "M2SettingsDetailViewController.h" | ||
|
||
@interface M2SettingsDetailViewController () | ||
|
||
@end | ||
|
||
@implementation M2SettingsDetailViewController | ||
|
||
- (id)initWithStyle:(UITableViewStyle)style | ||
{ | ||
if (self = [super initWithStyle:style]) { | ||
// Custom initialization | ||
} | ||
return self; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
self.navigationController.navigationBar.tintColor = [GSTATE scoreBoardColor]; | ||
} | ||
|
||
- (void)didReceiveMemoryWarning | ||
{ | ||
[super didReceiveMemoryWarning]; | ||
// Dispose of any resources that can be recreated. | ||
} | ||
|
||
# pragma mark - Table view data source | ||
|
||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView | ||
{ | ||
return 1; | ||
} | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | ||
{ | ||
return self.options.count; | ||
} | ||
|
||
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section | ||
{ | ||
return self.footer; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Settings Detail Cell"]; | ||
|
||
cell.textLabel.text = [self.options objectAtIndex:indexPath.row]; | ||
cell.accessoryType = ([Settings integerForKey:self.title] == indexPath.row) ? | ||
UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone; | ||
cell.tintColor = [GSTATE scoreBoardColor]; | ||
|
||
return cell; | ||
} | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | ||
{ | ||
[Settings setInteger:indexPath.row forKey:self.title]; | ||
[self.tableView reloadData]; | ||
GSTATE.needRefresh = YES; | ||
} | ||
|
||
@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
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
Oops, something went wrong.