解析
#import "ViewController.h"#import "define.h"#import "HotCollectCollectionViewCell.h"#import "JIexiModel.h"#import "AFNetworking.h"#import "TowTZViewController.h"@interface ViewController ()@property(nonatomic,strong)UICollectionView *collectionView;
@property(nonatomic,strong)NSMutableArray *mutablearray;
@end
@implementation ViewController
-(void)collectongview{
UICollectionViewFlowLayout *flowlayout = [[UICollectionViewFlowLayout alloc]init];
flowlayout.itemSize = CGSizeMake((SCREEN_WIDTH)/2.0, (SCREEN_WIDTH - 30)/2.0 *4/5);
//坚直滑动
flowlayout.scrollDirection = UICollectionViewScrollDirectionVertical;
//设置垂直方向的空隙
flowlayout.minimumLineSpacing=5;
//设置水平方向的空隙
flowlayout.minimumInteritemSpacing = 0;
// 实列化
_collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_HEIGHT - 64 - 49)collectionViewLayout:flowlayout];
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.tag = 10000;
[self.view addSubview:_collectionView];
//注册cell类
[_collectionView registerClass:[HotCollectCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
[self.view addSubview:_collectionView];
}
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"推荐";
self.view.backgroundColor = [UIColor lightGrayColor];
[self collectongview];
//获取链接
NSString *urlString = @"http://123.126.40.109:7003/asmr/videos/A1100101.shtml";
//解析网络数据
[JIexiModel httpGet:urlString parameters:nil reuslt:^(NSDictionary *reuslt) {
//将data里面的数据赋给NSArray
NSArray *arr = reuslt[@"result"];
_mutablearray = [[NSMutableArray alloc]i