Skip to content

Commit

Permalink
Merge pull request #2 from singro/master
Browse files Browse the repository at this point in the history
update source
  • Loading branch information
XVXVXXX committed Sep 25, 2015
2 parents b65883a + f8acb9f commit a9a80ee
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions v2ex-iOS/Controllers/V2NodesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ @interface V2NodesViewController () <UITableViewDataSource, UITableViewDelegate>

@property (nonatomic, strong) NSArray *headerTitleArray;
@property (nonatomic, strong) NSArray *nodesArray;

@property (nonatomic, strong) NSArray *myNodesArray;
@property (nonatomic, strong) NSArray *otherNodesArray;

@property (nonatomic, copy) NSURLSessionDataTask* (^getNodeListBlock)();
@property (nonatomic, copy) NSString *myNodeListPath;
Expand All @@ -39,13 +41,11 @@ - (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibB
if (!self.myNodesArray) {
self.myNodesArray = [NSArray array];
}
NSMutableArray *nodesArray = [NSMutableArray arrayWithObject:self.myNodesArray];;
NSArray *nodes = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"NodesList" ofType:@"plist"]];
[nodesArray addObjectsFromArray:nodes];

self.otherNodesArray = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"NodesList" ofType:@"plist"]];

[self loadData];

self.nodesArray = [self itemsWithDictArray:nodesArray];

}
return self;
}
Expand Down Expand Up @@ -75,16 +75,7 @@ - (void)viewDidLoad

self.sc_navigationItem.title = @"节点";
self.sc_navigationItem.leftBarButtonItem = self.leftBarItem;


// if ([V2CheckInManager manager].isExpired && kSetting.checkInNotiticationOn) {
// self.leftBarItem.badge = @"";
// } else {
// self.leftBarItem.badge = nil;
// }
//
// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveUpdateCheckInBadgeNotification) name:kUpdateCheckInBadgeNotification object:nil];


}

- (void)viewWillAppear:(BOOL)animated {
Expand Down Expand Up @@ -121,6 +112,16 @@ - (void)setNodesArray:(NSArray *)nodesArray {

#pragma mark - Data

- (void)loadData {

NSMutableArray *nodesArray = [NSMutableArray arrayWithObject:self.myNodesArray];;
[nodesArray addObjectsFromArray:self.otherNodesArray];

self.nodesArray = [self itemsWithDictArray:nodesArray];
[self.tableView reloadData];

}

- (NSArray *)itemsWithDictArray:(NSArray *)nodesArray {

NSMutableArray *items = [NSMutableArray new];
Expand Down Expand Up @@ -179,6 +180,7 @@ - (void)configureBlocks {
}

self.myNodesArray = list;
[self loadData];
[self endRefresh];

} failure:^(NSError *error) {
Expand Down

0 comments on commit a9a80ee

Please sign in to comment.