diff --git a/v2ex-iOS/Controllers/V2NodesViewController.m b/v2ex-iOS/Controllers/V2NodesViewController.m index 3503771..174d11f 100644 --- a/v2ex-iOS/Controllers/V2NodesViewController.m +++ b/v2ex-iOS/Controllers/V2NodesViewController.m @@ -16,7 +16,9 @@ @interface V2NodesViewController () @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; @@ -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; } @@ -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 { @@ -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]; @@ -179,6 +180,7 @@ - (void)configureBlocks { } self.myNodesArray = list; + [self loadData]; [self endRefresh]; } failure:^(NSError *error) {