1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| #import "ILHelpViewController.h" #import "ILSettingItem.h" #import "ILSettingGroup.h" #import "ILSettingCell.h" #import "ILSettingArrowItem.h" #import "ILSettingSwitchItem.h" #import "ILScoreNoticeViewController.h" #import "ILHtml.h" #import "ILHtmlViewController.h" #import "ILUINavigationController.h"
@interface ILHelpViewController () //存储help.json @property (nonatomic,strong) NSMutableArray *htmls;
@end
@implementation ILHelpViewController
-(NSMutableArray *)htmls { if (_htmls==nil) { _htmls=[NSMutableArray array]; NSString *fileName=[[NSBundle mainBundle]pathForResource:@"MyResource/Data/help.json" ofType:nil]; NSData *data=[NSData dataWithContentsOfFile:fileName]; NSArray *jsonArr=[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
for (NSDictionary *dict in jsonArr) { ILHtml *html=[ILHtml htmlWithDict:dict]; [_htmls addObject:html]; } } return _htmls; }
- (void)viewDidLoad { [super viewDidLoad]; [self addGroup0];
} -(void)addGroup0 { //第0组 // ILSettingItem *item1=[ILSettingArrowItem itemWithIcon:nil title:@"如何领奖?" destVcClass:nil]; // ILSettingItem *item2=[ILSettingArrowItem itemWithIcon:nil title:@"如何充值?"]; // ILSettingItem *item3=[ILSettingArrowItem itemWithIcon:nil title:@"如何提现?"]; // ILSettingItem *item4=[ILSettingArrowItem itemWithIcon:nil title:@"如何购彩?"]; // ILSettingItem *item5=[ILSettingArrowItem itemWithIcon:nil title:@"如何连续多期购买?"]; // // ILSettingGroup *group0=[[ILSettingGroup alloc]init]; // group0.items=@[item1,item2,item3,item4,item5]; // group0.header=@"标题头部-1"; // group0.footer=@"标题尾部-1"; // // [self.dataList addObject:group0]; NSMutableArray *items=[NSMutableArray array]; //遍历模型 for(ILHtml *html in self.htmls) { ILSettingArrowItem *item=[ILSettingArrowItem itemWithIcon:nil title:html.title destVcClass:nil]; [items addObject:item]; } ILSettingGroup *group0=[[ILSettingGroup alloc]init]; group0.items=items; [self.dataList addObject:group0];
}
//重写tableView的点击跳转 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //取出每一行对应的Html模型 ILHtml *html=self.htmls[indexPath.row]; ILHtmlViewController *htmlVc=[[ILHtmlViewController alloc]init]; htmlVc.html=html; htmlVc.title=html.title; ILUINavigationController *nav=[[ILUINavigationController alloc]initWithRootViewController:htmlVc]; [self presentViewController:nav animated:YES completion:nil]; }
@end
|