|
//
// offlineContentController.m
// ThePaperBase
//
// Created by scar1900 on 15/8/9.
// Copyright (c) 2015年 scar1900. All rights reserved.
//
#import "offlineContentController.h"
#import "offlineContentListController.h"
@interface offlineContentController()
@property(nonatomic, strong)nodeObjectBO *nodeInfo;
@property(nonatomic, strong)NSMutableArray *dataList;
@property(nonatomic, strong)offlineContentListController *tableVC;
@end
@implementation offlineContentController
@synthesize nodeID;
@synthesize path;
@synthesize resData = _resData;
@synthesize nodeInfo;
@synthesize tableVC;
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
self.titleStr = [NSString stringWithFormat:@"缓存-%@",self.nodeInfo.name];
self.tableVC = [[offlineContentListController alloc]init];
[self addChildViewController:self.tableVC];
self.tableVC.imagePath = self.path;
[self.view addSubview:self.tableVC.view];
[self.tableVC.view makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view.left);
make.right.equalTo(self.view.right);
make.top.equalTo(self.naviBar.bottom);
make.bottom.equalTo(self.view.bottom);
}];
self.tableVC.dataList = self.dataList;
[self.view bringSubviewToFront:self.naviBar];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needrefreshNightMode:) name:REFRESHAFTERNIGHTMODE object:nil];
}
- (void)needrefreshNightMode:(id)sender{
self.view.backgroundColor = [UIColor colorWithHexString:CELLBACKCOLOR];
}
- (void)setResData:(NSDictionary *)data {
_resData = data;
self.nodeInfo = setJsonDicToDataModel(data[@"nodeInfo"], [nodeObjectBO class]);
NSArray *tempArray = data[@"contList"];
NSMutableArray *array = [NSMutableArray array];
[tempArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
listContObjectVO *listBO = setJsonDicToDataModel(obj, [listContObjectVO class]);
[array addObject:listBO];
}];
self.dataList = [NSMutableArray arrayWithArray:array];
}
- (void)tapNaviBar:(id)sender {
[self.tableVC.tableView setContentOffset:CGPointZero animated:YES];
}
- (void)dealloc {
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
@end
|