ifish/Ifish/controllers/IfishTabControllers/探索/IfishLive/IfishNewLiveList/IfishLivePopularListViewCon...

68 lines
2.2 KiB
Objective-C

//
// IfishLivePopularListViewController.m
// CollectionViewTest
//
// Created by imac on 17/3/27.
// Copyright © 2017年 xiang. All rights reserved.
//
#import "IfishLivePopularListViewController.h"
@interface IfishLivePopularListViewController ()
@end
@implementation IfishLivePopularListViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.listType = IfishKanKanListTypePoPular;
self.view.backgroundColor = [UIColor blueColor];
[self initDataWithFirst:0 pageSize:10 isRefresh:NO];
}
-(void)initDataWithFirst:(NSInteger)firstResult pageSize:(NSInteger)pageSize isRefresh:(BOOL)isRefres{
NSString *orderType = [NSString stringWithFormat:@"%lu",(unsigned long)self.listType];
__weak typeof (self)weskSelf=self;
[AFHttpTool ifishGetliveRooms:firstResult pageSize:pageSize userId:self.userId orderType:orderType success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]){
if (isRefres) {
[weskSelf.dataArray removeAllObjects];
}
NSArray*roomArr=reDic[@"data"];
self.total =reDic[@"total"];
for (NSDictionary *dic in roomArr) {
IfishKankanListModel *mode=[[IfishKankanListModel alloc] initWithDict:dic];
[self.dataArray addObject:mode];
}
[weskSelf.collectionView reloadData];
}
[weskSelf endRefreshing];
} failure:^(NSError *err) {
[weskSelf endRefreshing];
[weskSelf.view makeToast:@"请求异常"];
}];
}
-(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end