//
Shoplistmainviewcontroller.m
Weili
//
Created by Zhang Lizhi on 16/10/13.
COPYRIGHT©2016 year Zhang determined. All rights reserved.
//
#import "ShopListMainViewController.h"
#import "ConstantHeader.h"
#import <Masonry/Masonry.h>
#import "OJLWaterLayout.h"
#import "Mbprogresshud+qsj.h"
#import "AlertUtil.h"
#import "MJREFRESH.H"
#import <SDWebImage/UIImageView+WebCache.h>
#import <SDCycleScrollView/SDCycleScrollView.h>
#import "Model.h"
#import "DynamicExperienceCell.h"
@interface Shoplistmainviewcontroller () <uicollectionviewdatasource, Uicollectionviewdelegate, Ojlwaterlayoutdelegate>
@property (Nonatomic,strong) Uiscrollview *mainscrollview;
@property (Nonatomic,strong) UIView *contentview;
@property (nonatomic, strong) uicollectionview* CollectionView;
@property (nonatomic, strong) nsmutablearray* Modelarray;
@property (nonatomic, strong) ojlwaterlayout* layout;
@end
@implementation Shoplistmainviewcontroller
-(Nsmutablearray *) Modelarray
{
if (!_modelarray) {
_modelarray = [[Model models] mutablecopy];
}
return _modelarray;
}
-(void) Viewdidload {
[Super Viewdidload];
Self.mainscrollview = [[Uiscrollview alloc]init];
[Self.view AddSubview:self.mainScrollView];
Self.mainScrollView.showsHorizontalScrollIndicator = NO;
Self.mainScrollView.showsVerticalScrollIndicator = NO;
Self.mainScrollView.bounces = NO;
Self.mainScrollView.backgroundColor = Normal_bkg_grey;
self.mainScrollView.scrollEnabled = YES;
[Self.mainscrollview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.edges.mas_equalTo (Self.view);
// }];
Today's recommended products main
ojlwaterlayout* layout = [[Ojlwaterlayout alloc] init];
Self.layout = layout;
Layout.numberofcol = 2;
layout.rowpanding = 7;
layout.colpanding = 7;
Layout.sectioninset = uiedgeinsetsmake (0, 0, 0, 0);
Layout.delegate = self;
[Layout autucontentsize];
Add Collection
Self.collectionview = [[Uicollectionview alloc]initwithframe:cgrectmake (0, Screen_size_height, SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT-49-64-40) CollectionViewLayout:self.layout];
Self.collectionView.dataSource = self;
Self.collectionView.delegate = self;
Self.collectionView.backgroundColor = Normal_bkg_grey;
[Self.view AddSubview:self.collectionView];
[Self.collectionview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.edges.mas_equalTo (Self.view);
}];
Register cell
[Self.collectionview Registerclass:[dynamicexperiencecell class] forcellwithreuseidentifier:@ "cell"];
With Contentview braces.
Self.contentview = [[UIView alloc] init];
[Self.collectionview AddSubview:self.contentView];
//
[Self.contentview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.left.mas_equalTo (0);
Make.top.mas_equalTo (0);
Make.width.mas_equalTo (Self.collectionView.mas_width);
Make.bottom.mas_equalTo (0);
}];
Carousel Map
UIView *lunboview = [[UIView alloc]init];
[Self.contentview Addsubview:lunboview];
Lunboview.backgroundcolor = [Uicolor Yellowcolor];
[Lunboview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Self.contentview);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (SCREEN_SIZE_WIDTH*2/5);
}];
The title of a hot item under a carousel map
UIView *rexiaotitleview = [[UIView alloc]init];
Rexiaotitleview.backgroundcolor = Normal_bkg_grey;
[Self.contentview Addsubview:rexiaotitleview];
[Rexiaotitleview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Lunboview.mas_bottom);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (40);
}];
UIView *lineone = [[UIView alloc]init];
UIView *rexiaoview = [[UIView alloc]init];
[Self.contentview Addsubview:rexiaoview];
Rexiaoview.backgroundcolor = [Uicolor Yellowcolor];
[Rexiaoview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Rexiaotitleview.mas_bottom);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (SCREEN_SIZE_WIDTH*2/5);
}];
The title of the commodity in the activity area below
UIView *activitytitleview = [[UIView alloc]init];
Activitytitleview.backgroundcolor = Normal_bkg_grey;
[Self.contentview Addsubview:activitytitleview];
[Activitytitleview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Rexiaoview.mas_bottom);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (40);
}];
UIView *activityview = [[UIView alloc]init];
[Self.contentview Addsubview:activityview];
Activityview.backgroundcolor = [Uicolor Yellowcolor];
[ActivityView mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Activitytitleview.mas_bottom);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (SCREEN_SIZE_WIDTH*2/5);
}];
Title of the product recommended today
UIView *todaytitleview = [[UIView alloc]init];
Todaytitleview.backgroundcolor = Normal_bkg_grey;
[Self.contentview Addsubview:todaytitleview];
[Todaytitleview mas_makeconstraints:^ (Masconstraintmaker *make) {
Make.top.mas_equalTo (Activityview.mas_bottom);
Make.left.mas_equalTo (Self.contentview);
Make.width.mas_equalTo (Screen_size_width);
Make.height.mas_equalTo (40);
}];
[Self.contentview mas_updateconstraints:^ (Masconstraintmaker *make) {
Make.left.mas_equalTo (0);
Make.top.mas_equalTo (0);
Make.width.mas_equalTo (Self.collectionView.mas_width);
Make.bottom.mas_equalTo (Todaytitleview.mas_bottom);
}];
Content Detail Offset
Self.collectionView.contentOffset = Cgpointmake (0, (SCREEN_SIZE_WIDTH*2/5 +40) *3);
}
-(void) Viewwillappear: (BOOL) animated{
[Super viewwillappear:animated];
Self.tabBarController.tabBar.hidden = NO;
}
-(void) didreceivememorywarning {
[Super didreceivememorywarning];
Dispose of any of the can is recreated.
<