-
Notifications
You must be signed in to change notification settings - Fork 160
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
1 parent
1f91e75
commit 103947e
Showing
25 changed files
with
597 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
19 changes: 19 additions & 0 deletions
19
e-Hentai/DownloadedGroupViewController/DownloadedGroupViewController.h
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,19 @@ | ||
// | ||
// DownloadedGroupViewController.h | ||
// e-Hentai | ||
// | ||
// Created by 啟倫 陳 on 2015/1/19. | ||
// Copyright (c) 2015年 ChilunChen. All rights reserved. | ||
// | ||
|
||
#import "ColorThemeViewController.h" | ||
|
||
#import "OpenMenuProtocol.h" | ||
#import "MenuDefaultCell.h" | ||
#import "DownloadedViewController.h" | ||
|
||
@interface DownloadedGroupViewController : ColorThemeViewController <UITableViewDataSource, UITableViewDelegate> | ||
|
||
@property (nonatomic, weak) id <MainViewControllerDelegate, OpenMenuProtocol> delegate; | ||
|
||
@end |
91 changes: 91 additions & 0 deletions
91
e-Hentai/DownloadedGroupViewController/DownloadedGroupViewController.m
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,91 @@ | ||
// | ||
// DownloadedGroupViewController.m | ||
// e-Hentai | ||
// | ||
// Created by 啟倫 陳 on 2015/1/19. | ||
// Copyright (c) 2015年 ChilunChen. All rights reserved. | ||
// | ||
|
||
#import "DownloadedGroupViewController.h" | ||
|
||
@interface DownloadedGroupViewController () | ||
|
||
@property (nonatomic, strong) UITableView *downloadedGroupTableView; | ||
@property (nonatomic, strong) NSMutableArray *groups; | ||
|
||
@end | ||
|
||
@implementation DownloadedGroupViewController | ||
|
||
#pragma mark - UITableViewDataSource | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
return [self.groups count]; | ||
} | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
MenuDefaultCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MenuDefaultCell"]; | ||
cell.selectionStyle = UITableViewCellSelectionStyleNone; | ||
cell.textLabel.text = self.groups[indexPath.row][@"title"]; | ||
return cell; | ||
} | ||
|
||
#pragma mark - UITableViewDelegate | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
DownloadedViewController *downloadedViewController = [DownloadedViewController new]; | ||
if ([self.groups[indexPath.row][@"value"] isKindOfClass:[NSString class]]) { | ||
downloadedViewController.group = self.groups[indexPath.row][@"value"]; | ||
} | ||
downloadedViewController.delegate = self.delegate; | ||
[self.navigationController pushViewController:downloadedViewController animated:YES]; | ||
} | ||
|
||
#pragma mark - private | ||
|
||
#pragma mark * init | ||
|
||
- (void)setupInitValues { | ||
self.groups = [NSMutableArray array]; | ||
} | ||
|
||
- (void)setupItemsOnNavigation { | ||
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBookmarks target:self.delegate action:@selector(sliderControl)]; | ||
self.navigationItem.leftBarButtonItem = menuButton; | ||
} | ||
|
||
- (void)setupDownloadedGroupTableView { | ||
self.downloadedGroupTableView = [[UITableView alloc] initWithFrame:self.view.bounds]; | ||
self.downloadedGroupTableView.delegate = self; | ||
self.downloadedGroupTableView.dataSource = self; | ||
self.downloadedGroupTableView.backgroundColor = [UIColor clearColor]; | ||
[self.downloadedGroupTableView registerClass:[MenuDefaultCell class] forCellReuseIdentifier:@"MenuDefaultCell"]; | ||
[self.view addSubview:self.downloadedGroupTableView]; | ||
} | ||
|
||
#pragma mark * misc | ||
|
||
//重載列表 | ||
- (void)reloadGroups { | ||
[self.groups removeAllObjects]; | ||
[self.groups addObject:@{@"title":@"全部", @"value":@""}]; | ||
[self.groups addObject:@{@"title":@"未分類", @"value":[NSNull null]}]; | ||
[self.groups addObjectsFromArray:[HentaiSaveLibrary groups]]; | ||
[self.downloadedGroupTableView reloadData]; | ||
} | ||
|
||
#pragma mark - life cycle | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
[self setupInitValues]; | ||
[self setupItemsOnNavigation]; | ||
[self setupDownloadedGroupTableView]; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
[self reloadGroups]; | ||
} | ||
|
||
@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
Oops, something went wrong.