123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // mySuggestVC.m
- // jiaPei
- //
- // Created by apple on 16/5/4.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "mySuggestVC.h"
- #import "HolderView.h"
- #import "FaqCell.h"
- @interface mySuggestVC ()<UITableViewDelegate,UITableViewDataSource>
- {
- UITableView *mainTableView;
- HolderView *holderV;
-
- NSArray *dataArray;
- }
- @end
- @implementation mySuggestVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"其它建议";
- self.view.backgroundColor = [UIColor whiteColor];
- [self configNavigationBar];
-
- dataArray = [NSArray array];
-
- mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStyleGrouped];
- mainTableView.height -= kNavOffSet;
- mainTableView.delegate = self;
- mainTableView.dataSource = self;
- mainTableView.estimatedSectionHeaderHeight = 0;
- mainTableView.estimatedSectionFooterHeight = 0;
- [self.view addSubview:mainTableView];
-
- holderV = [[HolderView alloc] initWithFrame:mainTableView.frame];
- [holderV freshBlock:^{
- [self getMySuggestReply];
- }];
- [self.view addSubview:holderV];
-
- [self getMySuggestReply];
- }
- #pragma mark maintableview delegate
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return dataArray.count;;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return 1;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- FaqCell* cell = [FaqCell cellForTableView:tableView];
- [cell setSuggestModel:dataArray[indexPath.section]];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSDictionary *dic = dataArray[indexPath.section];
-
- CGFloat h1 = [dic[@"ANSWERCONTENT"] heightForWid:kSize.width - 80 Font:14];
- if (h1 < 25) {
- h1 = 25;
- }
-
- CGFloat h2 = [dic[@"REPLYCONTENT"] heightForWid:kSize.width - 80 Font:14];
- if (h2 < 25) {
- h2 = 25;
- }
-
- return h1 + h2 + 90;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- if (0 == section) {
- return .1;
- }else{
- return 20;
- }
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- return .1;
- }
- #pragma mark 数据请求
- -(void)getMySuggestReply
- {
- if (![Util connectedToNetWork]) {
- return;
- }
-
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"user" Value:defUser.userDict[@"id"]];
-
- NSString* method = @"getMySuggestReply";
- [MBProgressHUD showLoadToView:self.view];
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- [MBProgressHUD hideHUDForView:self.view];
- [holderV setHidden:NO];
- if (!root) {
- [LoadingView showMsg:@"查询失败"];
- return;
- }
- NSString* code = root[@"code"];
- if (code.intValue >0)
- {
- [LoadingView showMsg:root[@"body"]];
- return;
- }
- if ([root[@"body"] count] < 1) {
- return;
- }
-
- dataArray = root[@"body"];
-
- [holderV setHidden:YES];
- [mainTableView reloadData];
- }];
-
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
|