Commit 086d455e authored by zhu's avatar zhu

no message

parent f24be9af
//
// CustomPictureShowCell.h
// Lighting
//
// Created by mac on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CustomPictureShowCell : UITableViewCell
@property (nonatomic,strong)UIImageView *pictureView1;
@property (nonatomic,strong)UIImageView *pictureView2;
@property (nonatomic,strong)UIImageView *pictureView3;
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withImageName:(NSString *)imageName;
@end
//
// CustomPictureShowCell.m
// Lighting
//
// Created by mac on 16/5/16.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "CustomPictureShowCell.h"
@implementation CustomPictureShowCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier withImageName:(NSString *)imageName{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
-(void)bulidLayout
{
self.pictureView1=[[UIImageView alloc]initWithFrame:CGRectMake(5, 5, (self.frame.size.width-30)/3, 140)];
[self addSubview:self.pictureView1];
self.pictureView2=[[UIImageView alloc]initWithFrame:CGRectMake(5+10+(self.frame.size.width-30)/3, 5, (self.frame.size.width-30)/3, 140)];
[self addSubview:self.pictureView2];
self.pictureView3=[[UIImageView alloc]initWithFrame:CGRectMake(5+10+2*(self.frame.size.width-30)/3 +10, 5, (self.frame.size.width-30)/3, 140)];
[self addSubview:self.pictureView3];
}
//- (void)setFrame:(CGRect)frame {
// [super setFrame:frame];
// frame.size.width = 800;
//
//
//}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -12,8 +12,17 @@
#import "FootSubView.h"
#import "SeceneLibraryView.h"
#import "ProductLibraryView.h"
@protocol FollowHeartViewAddpicturedelegate <NSObject>
@interface FollowHeartViewController : BaseViewController<LeftViewBtnClickdelegate,RightViewBtnClickdelegate,FootViewBtnClickdelegate,UIGestureRecognizerDelegate>
@required
//回调
- (void)buttonClick:(NSInteger)btnTag withButton:(UIButton *)button;
@end
@interface FollowHeartViewController : BaseViewController<LeftViewBtnClickdelegate,RightViewBtnClickdelegate,FootViewBtnClickdelegate,UIGestureRecognizerDelegate,AddSecenePicturedelegate,AddProductPicturedelegate>
@property (nonatomic,assign) id<FollowHeartViewAddpicturedelegate> delegate;
@property (nonatomic,strong) LeftSubView *leftSubView;
@property (nonatomic,strong) RightSubView *rightSubView;
@property (nonatomic,strong) FootSubView *footSubView;
......
......@@ -38,8 +38,6 @@
self.footSubView.delegate=self;
[self.view addSubview:self.footSubView];
}
#pragma subView delegate
......@@ -100,7 +98,7 @@
self.backGroundImageView.image=image;
}
//产品附图回调
- (void)addProductImage:(UIImage*)image
- (void)resetSubProductImage:(UIImage*)image
{
ImageCropperView *cropper=[[ImageCropperView alloc]initWithFrame:CGRectMake(400, 300, 300, 300)];
cropper.layer.borderWidth = 1.0;
......@@ -108,6 +106,16 @@
cropper.image = image;
[self.view addSubview:cropper];
}
//场景库选图回调
- (void)addSeceneImage:(UIImage *)image
{
[self.footSubView addFootSubViewImage:image];
}
//产品库选图回调
- (void)addProductImage:(UIImage *)image
{
[self.rightSubView addRightSubViewImage:image];
}
//全屏
-(void)setViewAnimations:(UIButton *)sender
{
......@@ -150,16 +158,18 @@
//添加场景
-(void)addSceneLibraryView
{
self.seceneLibraryView=[[SeceneLibraryView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
self.seceneLibraryView.backgroundColor=[UIColor clearColor];
[self.view addSubview:self.seceneLibraryView];
self.seceneLibraryView=[[SeceneLibraryView alloc]init];
self.seceneLibraryView.view.backgroundColor=[UIColor clearColor];
self.seceneLibraryView.delegate=self;
[self.view addSubview:self.seceneLibraryView.view];
}
//添加产品
-(void)addProductLibraryView
{
self.productLibraryView=[[ProductLibraryView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
self.productLibraryView.backgroundColor=[UIColor clearColor];
[self.view addSubview:self.productLibraryView];
self.productLibraryView=[[ProductLibraryView alloc]init];
self.productLibraryView.view.backgroundColor=[UIColor clearColor];
self.productLibraryView.delegate=self;
[self.view addSubview:self.productLibraryView.view];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......
......@@ -21,5 +21,6 @@
@property (nonatomic,strong)UIScrollView *scrollView;
@property (nonatomic,strong)NSMutableArray *dataArray;
-(void)addFootSubViewImage:(UIImage*)image;
@end
......@@ -21,7 +21,9 @@
-(void)initdata
{
self.dataArray=[[NSMutableArray alloc]initWithObjects:@"1",@"2",@"3",nil];
NSString *imageName = [NSString stringWithFormat:@"backView" ];
UIImage *image=[UIImage imageNamed:imageName];
self.dataArray=[[NSMutableArray alloc]initWithObjects:image,image,image,nil];
// 待接收
}
-(void)initSubView
......@@ -37,23 +39,29 @@
self.scrollView.showsHorizontalScrollIndicator = NO;
[self addSubview:self.scrollView];
// contentSize的y值为0表示在垂直方向上不做滚动
[self showSecenePicture];
}
-(void)showSecenePicture
{
[self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
self.scrollView.contentSize = CGSizeMake((self.dataArray.count+1) * (100+10), 0);
for (int i=0; i<self.dataArray.count; i++) {
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(i*(100+10), 30, 100, 100)];
NSString *imageName = [NSString stringWithFormat:@"backView" ];
[button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
UIImage *image=[self.dataArray objectAtIndex:i];
[button setImage:image forState:UIControlStateNormal];
button.tag=100+i;
[button addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
UILongPressGestureRecognizer *longPressGR =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress)];
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
longPressGR.minimumPressDuration = 0.5;
[button addGestureRecognizer:longPressGR];
[self.scrollView addSubview:button];
}
[self.scrollView addSubview:button];
}
}
//单次点击
//单次点击 设置为背景色
-(void)clicked:(UIButton*)sender
{
NSLog(@"%d",(sender.tag));
......@@ -64,11 +72,27 @@
// resetSuperBackGroundImage
}
//长按
-(void)longPress
//长按 删除已添加
-(void)longPress:(id)sender
{
UILongPressGestureRecognizer *longPress=sender;
if (longPress.state == UIGestureRecognizerStateBegan) {
NSInteger index=longPress.view.tag-100;
if (self.dataArray.count>index) {
[self.dataArray removeObjectAtIndex:index];
[self showSecenePicture];
}
}
else {
}
NSLog(@"长按");
}
//回调
-(void)footBtnDidSelected:(UIButton *)sender
{
if ([self.delegate respondsToSelector:@selector(buttonClick:withButton:)]) {
......@@ -77,6 +101,11 @@
}
}
-(void)addFootSubViewImage:(UIImage*)image
{
[self.dataArray addObject:image];
[self showSecenePicture]; //重新绘制图片数量
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
//
// ProductCollectionPictureCell.h
// Lighting
//
// Created by mac on 16/5/18.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ProductCollectionPictureCell : UICollectionViewCell
@property (strong, nonatomic) UIImageView *productImageView;
/**
* 产品参数
*/
@property (strong, nonatomic) UILabel *productParameter;
/**
* 产品价格
*/
@property (strong, nonatomic) UILabel *productPrice;
/**
* 加入购物车
*/
@property (strong, nonatomic) UIButton *addShoppingbags;
@end
//
// ProductCollectionPictureCell.m
// Lighting
//
// Created by mac on 16/5/18.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "ProductCollectionPictureCell.h"
@implementation ProductCollectionPictureCell
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.productImageView =[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
self.productImageView.image = [UIImage imageNamed:@"05产品库-详情_03"];
[self addSubview:self.productImageView];
}
return self;
}
@end
......@@ -7,9 +7,19 @@
//
#import <UIKit/UIKit.h>
#import "CustomPictureShowCell.h"
#import "ProductCollectionPictureCell.h"
@protocol AddProductPicturedelegate <NSObject>
@interface ProductLibraryView :UIView<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@required
//回调
- (void)addProductImage:(UIImage *)image;
@end
@interface ProductLibraryView :BaseViewController<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource,UITableViewDataSource,UICollectionViewDataSource,
UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@property (nonatomic,assign) id<AddProductPicturedelegate> delegate;
@property (nonatomic,strong) UIView *subView;
@property (nonatomic,strong) UIView *headerView;
@property (nonatomic,strong) UITableView *seceneTableView;
......@@ -22,5 +32,5 @@
@property (nonatomic,strong) NSMutableArray *array1;
@property (nonatomic,strong) NSMutableArray *array2;
@property (nonatomic,strong) NSMutableArray *array3;
@property (nonatomic,strong) UICollectionView *collectionView;
@end
......@@ -9,14 +9,20 @@
#import "ProductLibraryView.h"
@implementation ProductLibraryView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self initdata];
[self initSubView];
}
return self;
- (void)viewDidLoad {
[self initdata];
[self initSubView];
}
//- (instancetype)initWithFrame:(CGRect)frame
//{
// if (self = [super initWithFrame:frame]) {
// [self initdata];
// [self initSubView];
// }
// return self;
//}
-(void)initdata
{
self.arrayData=[[NSMutableArray alloc]init];
......@@ -41,13 +47,13 @@
btn.tag=100 +i;
btn.layer.masksToBounds = YES;
btn.layer.cornerRadius = 23;
[self addSubview:btn];
[self.view addSubview:btn];
}
}
self.subView=[[UIView alloc]initWithFrame:CGRectMake(100, 50, ScreenWidth-300, ScreenHeight-200)];
self.subView.backgroundColor=[UIColor whiteColor];
[self addSubview:self.subView];
[self.view addSubview:self.subView];
//点击手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView:)];
......@@ -75,10 +81,20 @@
self.seceneTableView.dataSource=self;
[self.subView addSubview:self.seceneTableView];
self.pictureTableView=[[UITableView alloc]initWithFrame:CGRectMake( 0, 50, self.headerView.frame.size.width, self.subView.frame.size.height-50)];
self.pictureTableView.delegate=self;
self.pictureTableView.dataSource=self;
[self.subView addSubview:self.pictureTableView];
//确定是水平滚动,还是垂直滚动
UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayout alloc] init];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
self.collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake( 0, 50, self.headerView.frame.size.width, self.subView.frame.size.height-50) collectionViewLayout:flowLayout];
self.collectionView.dataSource=self;
self.collectionView.delegate=self;
[self.collectionView setBackgroundColor:[UIColor clearColor]];
//注册Cell,必须要有
[self.collectionView registerClass:[ProductCollectionPictureCell class] forCellWithReuseIdentifier:@"UICollectionViewCell"];
[self.subView addSubview:self.collectionView];
}
-(void)selectedType:(UIButton *)sender
{
......@@ -113,6 +129,63 @@
}
[self.seceneTableView reloadData];
}
#pragma mark -- UICollectionViewDataSource
//定义展示的Section的个数
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 10;
}
//定义展示的UICollectionViewCell的个数
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 3;
}
//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * CellIdentifier = @"UICollectionViewCell";
ProductCollectionPictureCell * cell = (ProductCollectionPictureCell*)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}
#pragma mark --UICollectionViewDelegateFlowLayout
//定义每个Item 的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return CGSizeMake(190, 130);
}
//定义每个UICollectionView 的边距
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
return UIEdgeInsetsMake(10, 10, 0, 20);
}
//定义每个UICollectionView 的纵向间距
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
return 2;
}
#pragma mark --UICollectionViewDelegate
//UICollectionView被选中时调用的方法
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
ProductCollectionPictureCell * cell = (ProductCollectionPictureCell *)[collectionView cellForItemAtIndexPath:indexPath];
if ([self.delegate respondsToSelector:@selector(addProductImage:)]) {
[self.delegate addProductImage:cell.productImageView.image];
}
}
//返回这个UICollectionView是否可以被选择
-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
......@@ -143,9 +216,7 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([tableView isEqual:self.seceneTableView])
{
static NSString *cellID = @"ChooseTansferCell";
static NSString *cellID = @"ChooseTansferCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
......@@ -153,24 +224,9 @@
}
cell.textLabel.text=[self.arrayData objectAtIndex:indexPath.row];
// 05产品库-详情_03
return cell;
}else
{
static NSString *CellID = @"TansferCell";
CustomPictureShowCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
if (cell == nil) {
cell = [[CustomPictureShowCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID withImageName:nil];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
cell.pictureView1.image=[UIImage imageNamed:@"05产品库-详情_03"];
cell.pictureView2.image=[UIImage imageNamed:@"05产品库-详情_03"];
cell.pictureView3.image=[UIImage imageNamed:@"05产品库-详情_03"];
return cell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
......@@ -179,11 +235,11 @@
}
-(void)DismissScreenView:(UITapGestureRecognizer*)sender{
CGPoint point = [sender locationInView:self];
CGPoint point = [sender locationInView:self.view];
if (point.x<100 || point.x >ScreenWidth-100||point.y<50||point.y>ScreenHeight-150) {
if (self) {
[self removeFromSuperview];
[self.view removeFromSuperview];
}
}
}
......
......@@ -12,11 +12,12 @@
//回调
- (void)buttonClick:(NSInteger)btnTag withButton:(UIButton *)button;
- (void)addProductImage:(UIImage*)image;
- (void)resetSubProductImage:(UIImage*)image;
@end
@interface RightSubView : UIView
@property (nonatomic,assign) id<RightViewBtnClickdelegate> delegate;
@property (nonatomic,strong)NSMutableArray *dataArray;
@property (nonatomic,strong)UIScrollView *scrollView;
-(void)addRightSubViewImage:(UIImage*)image;
@end
......@@ -20,7 +20,9 @@
}
-(void)initdata
{
self.dataArray=[[NSMutableArray alloc]initWithObjects:@"1",@"2",@"3",nil];
NSString *imageName = [NSString stringWithFormat:@"05产品库-详情_03" ];
UIImage *image= [UIImage imageNamed:imageName];
self.dataArray=[[NSMutableArray alloc]initWithObjects:image,image,image,nil];
// 待接收
}
......@@ -33,48 +35,61 @@
[button addTarget:self action:@selector(rightBtnDidSelected:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:button];
self.scrollView=[[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height-100)];
// 禁用滚动条,只设置水平方向的滚动条即可,竖直方向的滚动范围是0,所以没必要设置
self.scrollView.showsVerticalScrollIndicator = NO;
[self addSubview:self.scrollView];
[self showProductPicture];
}
-(void)showProductPicture
{
[self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
// contentSize的y值为0表示在垂直方向上不做滚动
self.scrollView.contentSize = CGSizeMake(0, (self.dataArray.count+1) * (100+10));
for (int i=0; i<self.dataArray.count; i++) {
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(80, 20+i*(100+10), 100, 100)];
NSString *imageName = [NSString stringWithFormat:@"05产品库-详情_03" ];
[button setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
UIImage *image=[self.dataArray objectAtIndex:i];
[button setImage:image forState:UIControlStateNormal];
button.tag=100+i;
[button addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
UILongPressGestureRecognizer *longPressGR =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress)];
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
longPressGR.minimumPressDuration = 0.5;
[button addGestureRecognizer:longPressGR];
[self.scrollView addSubview:button];
// UIImageView *imageView = [[UIImageView alloc] init];
// // 定义图片名,通过循环把所有的图片添加到scrollView中
// NSString *imageName = [NSString stringWithFormat:@"05产品库-详情_03" ];
// imageView.frame = CGRectMake(80, 20+i*(100+10), 100, 100);
// imageView.image = [UIImage imageNamed:imageName];
// [self.scrollView addSubview:imageView];
}
// 禁用滚动条,只设置水平方向的滚动条即可,竖直方向的滚动范围是0,所以没必要设置
self.scrollView.showsVerticalScrollIndicator = NO;
[self addSubview:self.scrollView];
}
//单次点击
-(void)clicked:(UIButton*)sender
{
NSLog(@"%d",(sender.tag));
if ([self.delegate respondsToSelector:@selector(addProductImage:)]) {
if ([self.delegate respondsToSelector:@selector(resetSubProductImage:)]) {
[self.delegate addProductImage:sender.imageView.image];
[self.delegate resetSubProductImage:sender.imageView.image];
}
// resetSuperBackGroundImage
}
//长按
-(void)longPress
-(void)longPress:(id)sender
{
NSLog(@"长按");
UILongPressGestureRecognizer *longPress=sender;
if (longPress.state == UIGestureRecognizerStateBegan) {
NSInteger index=longPress.view.tag-100;
if (self.dataArray.count>index) {
[self.dataArray removeObjectAtIndex:index];
[self showProductPicture];
}
}
else {
}
NSLog(@"长按");
}
-(void)rightBtnDidSelected:(UIButton *)sender
......@@ -84,6 +99,12 @@
[self.delegate buttonClick:sender.tag withButton:sender];
}
}
-(void)addRightSubViewImage:(UIImage*)image
{
[self.dataArray addObject:image];
[self showProductPicture];
}
/*
// Only override drawRect: if you perform custom drawing.
......
......@@ -94,15 +94,9 @@
condition.page = page;
[self getSceneLibrarydatas:condition];
}
#pragma mark -获取场景筛选数据
- (void)getdatasAction
{
[[NetworkRequestClassManager Manager] NetworkRequestWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/scene/getSceneFilter"] WithRequestType:1 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
......
//
// SeceneCollectionPictureCell.h
// Lighting
//
// Created by mac on 16/5/17.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SeceneCollectionPictureCell : UICollectionViewCell
@property (strong, nonatomic)UIImageView *imageView;
@end
//
// SeceneCollectionPictureCell.m
// Lighting
//
// Created by mac on 16/5/17.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "SeceneCollectionPictureCell.h"
@implementation SeceneCollectionPictureCell
-(id)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if (self) {
self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)];
self.imageView.image = [UIImage imageNamed:@"backView"];
[self addSubview:self.imageView];
}
return self;
}
@end
......@@ -7,9 +7,19 @@
//
#import <UIKit/UIKit.h>
#import "CustomPictureShowCell.h"
#import "SeceneCollectionPictureCell.h"
@protocol AddSecenePicturedelegate <NSObject>
@interface SeceneLibraryView : UIView<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource>
@required
//回调
- (void)addSeceneImage:(UIImage *)image;
@end
@interface SeceneLibraryView : BaseViewController<UIGestureRecognizerDelegate,UITableViewDelegate,UITableViewDataSource,UICollectionViewDataSource,
UICollectionViewDelegate,UICollectionViewDelegateFlowLayout>
@property (nonatomic,assign) id<AddSecenePicturedelegate> delegate;
@property (nonatomic,strong) UIView *subView;
@property (nonatomic,strong) UIView *headerView;
@property (nonatomic,strong) UITableView *seceneTableView;
......@@ -21,4 +31,5 @@
@property (nonatomic,strong) NSMutableArray *array1;
@property (nonatomic,strong) NSMutableArray *array2;
@property (nonatomic,strong) NSMutableArray *array3;
@property (nonatomic,strong) UICollectionView *collectionView;
@end
......@@ -7,16 +7,25 @@
//
#import "SeceneLibraryView.h"
@interface SeceneLibraryView ()
@end
@implementation SeceneLibraryView
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self initdata];
[self initView];
}
return self;
- (void)viewDidLoad {
[self initdata];
[self initView];
}
//- (instancetype)initWithFrame:(CGRect)frame
//{
// if (self = [super initWithFrame:frame]) {
// [self initdata];
// [self initView];
// }
// return self;
//}
//#pragma mark -获取场景筛选数据
//- (void)getdatasAction
//{
......@@ -84,45 +93,43 @@
self.kongJianBtn.backgroundColor=[UIColor whiteColor];
[self.kongJianBtn setTitle:@"空间 " forState:UIControlStateNormal];
[self.kongJianBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// [self.kongJianBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
self.kongJianBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
[self.kongJianBtn addTarget:self action:@selector(selectedType:) forControlEvents:UIControlEventTouchUpInside];
self.kongJianBtn.tag=101;
self.kongJianBtn.layer.masksToBounds = YES;
self.kongJianBtn.layer.cornerRadius = 15;
[self addSubview:self.kongJianBtn];
[self.view addSubview:self.kongJianBtn];
// 风格
self.fengGeBtn=[UIButton buttonWithType:UIButtonTypeCustom];
self.fengGeBtn.frame=CGRectMake(ScreenWidth-250, 102, 100, 46) ;
self.fengGeBtn.backgroundColor=[UIColor whiteColor];
[self.fengGeBtn setTitle:@"风格 " forState:UIControlStateNormal];
[self.fengGeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// [self.fengGeBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
self.fengGeBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
[self.fengGeBtn addTarget:self action:@selector(selectedType:) forControlEvents:UIControlEventTouchUpInside];
self.fengGeBtn.tag=102;
self.fengGeBtn.layer.masksToBounds = YES;
self.fengGeBtn.layer.cornerRadius = 15;
[self addSubview:self.fengGeBtn];
[self.view addSubview:self.fengGeBtn];
//类型
self.leiXingBtn=[UIButton buttonWithType:UIButtonTypeCustom];
self.leiXingBtn.frame=CGRectMake(ScreenWidth-250, 152, 100, 46) ;
self.leiXingBtn.backgroundColor=[UIColor whiteColor];
[self.leiXingBtn setTitle:@"类型 " forState:UIControlStateNormal];
[self.leiXingBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
// [self.leiXingBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
self.leiXingBtn.contentEdgeInsets = UIEdgeInsetsMake(0, 60, 0, 0);
[self.leiXingBtn addTarget:self action:@selector(selectedType:) forControlEvents:UIControlEventTouchUpInside];
self.leiXingBtn.tag=103;
self.leiXingBtn.layer.masksToBounds = YES;
self.leiXingBtn.layer.cornerRadius = 15;
[self addSubview:self.leiXingBtn];
[self.view addSubview:self.leiXingBtn];
self.subView=[[UIView alloc]initWithFrame:CGRectMake(100, 50, ScreenWidth-300, ScreenHeight-200)];
self.subView.backgroundColor=[UIColor whiteColor];
[self addSubview:self.subView];
[self.view addSubview:self.subView];
//点击手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView:)];
tap.delegate = self;
......@@ -141,16 +148,25 @@
[self.headerView addSubview:btn];
UILabel *lable=[[UILabel alloc]initWithFrame:CGRectMake(45, 10, 100, 30)];
lable.text=@"选择场景";
[self.headerView addSubview:lable];
[self.headerView addSubview:lable];
self.seceneTableView=[[UITableView alloc]initWithFrame:CGRectMake( self.headerView.frame.size.width, 0, 100, self.subView.frame.size.height)];
self.seceneTableView.delegate=self;
self.seceneTableView.dataSource=self;
[self.subView addSubview:self.seceneTableView];
//确定是水平滚动,还是垂直滚动
UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayout alloc] init];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];
self.pictureTableView=[[UITableView alloc]initWithFrame:CGRectMake( 0, 50, self.headerView.frame.size.width, self.subView.frame.size.height-50)];
self.pictureTableView.delegate=self;
self.pictureTableView.dataSource=self;
[self.subView addSubview:self.pictureTableView];
self.collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake( 0, 50, self.headerView.frame.size.width, self.subView.frame.size.height-50) collectionViewLayout:flowLayout];
self.collectionView.dataSource=self;
self.collectionView.delegate=self;
[self.collectionView setBackgroundColor:[UIColor clearColor]];
//注册Cell,必须要有
[self.collectionView registerClass:[SeceneCollectionPictureCell class] forCellWithReuseIdentifier:@"UICollectionViewCell"];
[self.subView addSubview:self.collectionView];
}
-(void)selectedType:(UIButton *)sender
{
......@@ -172,39 +188,79 @@
}
[self.seceneTableView reloadData];
}
#pragma mark -- UICollectionViewDataSource
//定义展示的Section的个数
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 10;
}
//定义展示的UICollectionViewCell的个数
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 3;
}
//每个UICollectionView展示的内容
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * CellIdentifier = @"UICollectionViewCell";
SeceneCollectionPictureCell * cell = (SeceneCollectionPictureCell*)[collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
return cell;
}
#pragma mark --UICollectionViewDelegateFlowLayout
//定义每个Item 的大小
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
return CGSizeMake(190, 130);
}
//定义每个UICollectionView 的边距
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
return UIEdgeInsetsMake(10, 10, 0, 20);
}
//定义每个UICollectionView 的纵向间距
-(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
return 2;
}
#pragma mark --UICollectionViewDelegate
//UICollectionView被选中时调用的方法
-(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
SeceneCollectionPictureCell * cell = (SeceneCollectionPictureCell *)[collectionView cellForItemAtIndexPath:indexPath];
if ([self.delegate respondsToSelector:@selector(addSeceneImage:)]) {
[self.delegate addSeceneImage:cell.imageView.image];
}
}
//返回这个UICollectionView是否可以被选择
-(BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
#pragma mark - 协议方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{ if ([tableView isEqual:self.seceneTableView])
{
{
return self.arrayData.count;
}else
{
return 5;
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([tableView isEqual:self.seceneTableView])
{
return 50;
}else
{
return 150;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([tableView isEqual:self.seceneTableView])
{
static NSString *cellID = @"ChooseTansferCell";
static NSString *cellID = @"ChooseTansferCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
......@@ -214,22 +270,7 @@
cell.textLabel.text=[self.arrayData objectAtIndex:indexPath.row];
return cell;
}else
{
static NSString *CellID = @"TansferCell";
CustomPictureShowCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
if (cell == nil) {
cell = [[CustomPictureShowCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID withImageName:nil];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
cell.pictureView1.image=[UIImage imageNamed:@"textpicture"];
cell.pictureView2.image=[UIImage imageNamed:@"textpicture"];
cell.pictureView3.image=[UIImage imageNamed:@"textpicture"];
return cell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
......@@ -240,11 +281,11 @@
-(void)DismissScreenView:(UITapGestureRecognizer*)sender{
CGPoint point = [sender locationInView:self];
CGPoint point = [sender locationInView:self.view];
if (point.x<100 || point.x >ScreenWidth-100||point.y<50||point.y>ScreenHeight-150) {
if (self) {
[self removeFromSuperview];
[self.view removeFromSuperview];
}
}
}
......
......@@ -9,12 +9,13 @@
/* Begin PBXBuildFile section */
0447085E1CD7C06B00555827 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0447085D1CD7C06B00555827 /* LoginViewController.m */; };
044708611CD7C1E800555827 /* MainSetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 044708601CD7C1E800555827 /* MainSetViewController.m */; };
044CD6EE1CEB771C0004A715 /* SeceneCollectionPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 044CD6ED1CEB771C0004A715 /* SeceneCollectionPictureCell.m */; };
044CD6F11CEB81350004A715 /* ProductCollectionPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 044CD6F01CEB81350004A715 /* ProductCollectionPictureCell.m */; };
0470D6111CE2936000647F0F /* SeceneLibraryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0470D6101CE2936000647F0F /* SeceneLibraryView.m */; };
0470D6141CE2938000647F0F /* ProductLibraryView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0470D6131CE2938000647F0F /* ProductLibraryView.m */; };
04A14A251CE0FC3A00DAD5F3 /* LeftSubView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A14A241CE0FC3A00DAD5F3 /* LeftSubView.m */; };
04A14A281CE0FC5600DAD5F3 /* RightSubView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A14A271CE0FC5600DAD5F3 /* RightSubView.m */; };
04A14A2B1CE0FC7F00DAD5F3 /* FootSubView.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A14A2A1CE0FC7F00DAD5F3 /* FootSubView.m */; };
04A520411CE9365D001D4520 /* CustomPictureShowCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A520401CE9365D001D4520 /* CustomPictureShowCell.m */; };
060D397C1CE45CFE0082AECD /* ImageCropperView.m in Sources */ = {isa = PBXBuildFile; fileRef = 060D39791CE45CFE0082AECD /* ImageCropperView.m */; };
060D397D1CE45CFE0082AECD /* UIImage+Rotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 060D397B1CE45CFE0082AECD /* UIImage+Rotation.m */; };
2906B5D71CD89246000849B4 /* ClientDetailsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2906B5D61CD89246000849B4 /* ClientDetailsTableViewCell.m */; };
......@@ -123,6 +124,10 @@
0447085D1CD7C06B00555827 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = "<group>"; };
0447085F1CD7C1E800555827 /* MainSetViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainSetViewController.h; sourceTree = "<group>"; };
044708601CD7C1E800555827 /* MainSetViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainSetViewController.m; sourceTree = "<group>"; };
044CD6EC1CEB771C0004A715 /* SeceneCollectionPictureCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SeceneCollectionPictureCell.h; sourceTree = "<group>"; };
044CD6ED1CEB771C0004A715 /* SeceneCollectionPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SeceneCollectionPictureCell.m; sourceTree = "<group>"; };
044CD6EF1CEB81350004A715 /* ProductCollectionPictureCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductCollectionPictureCell.h; sourceTree = "<group>"; };
044CD6F01CEB81350004A715 /* ProductCollectionPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductCollectionPictureCell.m; sourceTree = "<group>"; };
0470D60F1CE2936000647F0F /* SeceneLibraryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SeceneLibraryView.h; sourceTree = "<group>"; };
0470D6101CE2936000647F0F /* SeceneLibraryView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SeceneLibraryView.m; sourceTree = "<group>"; };
0470D6121CE2938000647F0F /* ProductLibraryView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductLibraryView.h; sourceTree = "<group>"; };
......@@ -133,8 +138,6 @@
04A14A271CE0FC5600DAD5F3 /* RightSubView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RightSubView.m; sourceTree = "<group>"; };
04A14A291CE0FC7F00DAD5F3 /* FootSubView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FootSubView.h; sourceTree = "<group>"; };
04A14A2A1CE0FC7F00DAD5F3 /* FootSubView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FootSubView.m; sourceTree = "<group>"; };
04A5203F1CE9365D001D4520 /* CustomPictureShowCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomPictureShowCell.h; sourceTree = "<group>"; };
04A520401CE9365D001D4520 /* CustomPictureShowCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomPictureShowCell.m; sourceTree = "<group>"; };
060D39781CE45CFE0082AECD /* ImageCropperView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageCropperView.h; sourceTree = "<group>"; };
060D39791CE45CFE0082AECD /* ImageCropperView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageCropperView.m; sourceTree = "<group>"; };
060D397A1CE45CFE0082AECD /* UIImage+Rotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Rotation.h"; sourceTree = "<group>"; };
......@@ -406,8 +409,10 @@
04A5203E1CE93604001D4520 /* customCell */ = {
isa = PBXGroup;
children = (
04A5203F1CE9365D001D4520 /* CustomPictureShowCell.h */,
04A520401CE9365D001D4520 /* CustomPictureShowCell.m */,
044CD6EC1CEB771C0004A715 /* SeceneCollectionPictureCell.h */,
044CD6ED1CEB771C0004A715 /* SeceneCollectionPictureCell.m */,
044CD6EF1CEB81350004A715 /* ProductCollectionPictureCell.h */,
044CD6F01CEB81350004A715 /* ProductCollectionPictureCell.m */,
);
name = customCell;
sourceTree = "<group>";
......@@ -1294,7 +1299,6 @@
29A938221CDADE4700F21E54 /* ProductDetailsTableViewCell.m in Sources */,
29E384BE1CE9933300888199 /* AdditionalTableViewCell.m in Sources */,
29E384C81CE9A8BF00888199 /* SearchCollectionViewCell.m in Sources */,
04A520411CE9365D001D4520 /* CustomPictureShowCell.m in Sources */,
2992493D1CDB3E8900786B1E /* GenerateOrdersModifyTableViewCell.m in Sources */,
29BB27741CD9DFAC009A0813 /* SceneLibraryViewController.m in Sources */,
29E384D11CE9C65700888199 /* SearchViewController.m in Sources */,
......@@ -1310,6 +1314,7 @@
29EAAEA01CDC79DC00C4DBA2 /* CustomerOrderViewController.m in Sources */,
2928F8321CD09E320036D761 /* Toolview.m in Sources */,
2942F8A61CDD80C2005B377E /* authenticateView.m in Sources */,
044CD6F11CEB81350004A715 /* ProductCollectionPictureCell.m in Sources */,
29BFBD8F1CE44BA900C238FB /* goodsDetailsSectionview.m in Sources */,
290887131CE5DF16000B7097 /* ShopcarModel.m in Sources */,
29BB27681CD9D38E009A0813 /* AllpriceTableViewCell.m in Sources */,
......@@ -1328,6 +1333,7 @@
29706DA91CD082990003C412 /* AppDelegate.m in Sources */,
29834EB41CDF1EAA001A484F /* screeningSecondView.m in Sources */,
29706DA61CD082990003C412 /* main.m in Sources */,
044CD6EE1CEB771C0004A715 /* SeceneCollectionPictureCell.m in Sources */,
29A938251CDAE31200F21E54 /* ProductDetailsHeaderView.m in Sources */,
299876421CD99E4000C90D0A /* OrderdetailsViewController.m in Sources */,
29EC331A1CE023D5005F0C13 /* ChangePasswordViewController.m in Sources */,
......
......@@ -32,9 +32,9 @@ PODS:
- MMDrawerController/Core
- MMDrawerController/Subclass (0.6.0):
- MMDrawerController/Core
- SDWebImage (3.7.6):
- SDWebImage/Core (= 3.7.6)
- SDWebImage/Core (3.7.6)
- SDWebImage (3.7.5):
- SDWebImage/Core (= 3.7.5)
- SDWebImage/Core (3.7.5)
- SVProgressHUD (2.0.3)
DEPENDENCIES:
......@@ -58,7 +58,7 @@ SPEC CHECKSUMS:
MJExtension: d86aacb740c87519d20e3cca55b6fa4be6cc7548
MJRefresh: 743e6404967d1c2c688472ea3ecfde247d872db4
MMDrawerController: e3a54a5570388463ad3b36975251575b50c4e1a0
SDWebImage: c325cf02c30337336b95beff20a13df489ec0ec9
SDWebImage: 69c6303e3348fba97e03f65d65d4fbc26740f461
SVProgressHUD: b0830714205bea1317ea1a2ebc71e5633af334d4
COCOAPODS: 0.39.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment