Commit e814e7ed authored by 勾芒's avatar 勾芒

debug

parent e32a2727
......@@ -64,7 +64,7 @@
//单次点击 设置为背景色
-(void)clicked:(UIButton*)sender
{
NSLog(@"%d",(sender.tag));
NSLog(@"%ld",(long)(sender.tag));
if ([self.delegate respondsToSelector:@selector(resetSuperBackGroundImage:)]) {
[self.delegate resetSuperBackGroundImage:sender.imageView.image];
......
......@@ -410,7 +410,7 @@
break;
case 101://类型
{
if ([[NSString stringWithFormat:@"%d",sender.tag-100 ]isEqualToString:[NSString stringWithFormat:@"%@",[self.showSection firstObject]]]) {
if ([[NSString stringWithFormat:@"%ld",sender.tag-100 ]isEqualToString:[NSString stringWithFormat:@"%@",[self.showSection firstObject]]]) {
[self.cellArray removeAllObjects ];
[self.showSection removeAllObjects];
[self.seceneTableView reloadData];
......@@ -421,7 +421,7 @@
self.selectedCode = [[self.arrayData objectAtIndex_opple:sender.tag-100] fid] ;
[self.collectionView.mj_header beginRefreshing];
self.cellArray=[NSMutableArray arrayWithArray:[[self.arrayData objectAtIndex_opple:sender.tag-100] children]];
[self.showSection addObject:[NSString stringWithFormat:@"%d",sender.tag-100]];
[self.showSection addObject:[NSString stringWithFormat:@"%ld",sender.tag-100]];
[self.seceneTableView reloadData];
}
......@@ -557,7 +557,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (self.selectedIndex==101) {//类型
if ([self.showSection containsObject:[NSString stringWithFormat:@"%d",section]]) {
if ([self.showSection containsObject:[NSString stringWithFormat:@"%ld",(long)section]]) {
return self.cellArray.count;
}else
{
......
......@@ -519,38 +519,38 @@
#pragma mark -筛选
- (void)ScreeningButtonClick
{
ExperienceCentreViewController *ExperienceCenter = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"ExperienceCentre"];
//
// ExperienceCentreViewController *ExperienceCenter = [[self getStoryboardWithName] instantiateViewControllerWithIdentifier:@"ExperienceCentre"];
//// [self presentViewController:ExperienceCenter animated:YES completion:nil];
//
// ExperienceCenter.modalPresentationStyle = UIModalPresentationOverFullScreen;
// UIPopoverPresentationController *popover = ExperienceCenter.popoverPresentationController;
// popover.sourceView = ExperienceCenter.view;
// [self presentViewController:ExperienceCenter animated:YES completion:nil];
ExperienceCenter.modalPresentationStyle = UIModalPresentationOverFullScreen;
UIPopoverPresentationController *popover = ExperienceCenter.popoverPresentationController;
popover.sourceView = ExperienceCenter.view;
[self presentViewController:ExperienceCenter animated:YES completion:nil];
self.screenView = [[[NSBundle mainBundle] loadNibNamed:@"ScreeningView" owner:self options:nil]firstObject];
self.screenView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
self.screenView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
self.screenView.delegate = self;
//点击手势
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView)];
tap.delegate = self;
tap.cancelsTouchesInView = NO;
[self.screenView addGestureRecognizer:tap];
self.screenView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
[self.view.window addSubview:self.screenView];
self.screenView.alpha = 0;
// self.screenView = [[[NSBundle mainBundle] loadNibNamed:@"ScreeningView" owner:self options:nil]firstObject];
// self.screenView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
// self.screenView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
// self.screenView.delegate = self;
// //点击手势
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(DismissScreenView)];
// tap.delegate = self;
// tap.cancelsTouchesInView = NO;
// [self.screenView addGestureRecognizer:tap];
// self.screenView.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
// [self.view.window addSubview:self.screenView];
// self.screenView.alpha = 0;
//
// //监听Segmented菜单
// [self.screenView.sortingSegmented addTarget:self action:@selector(sortingSegmentedClick:) forControlEvents:UIControlEventValueChanged];
//
// self.selectedIndex = 0;
// [self CreateClassificationView];
//
// [UIView animateWithDuration:0.2 animations:^{
//
// self.screenView.alpha = 1;
// }];
//监听Segmented菜单
[self.screenView.sortingSegmented addTarget:self action:@selector(sortingSegmentedClick:) forControlEvents:UIControlEventValueChanged];
self.selectedIndex = 0;
[self CreateClassificationView];
[UIView animateWithDuration:0.2 animations:^{
self.screenView.alpha = 1;
}];
}
......
......@@ -20,8 +20,8 @@
}
-(void)initdata
{
NSString *imageName = [NSString stringWithFormat:@"05产品库-详情_03" ];
UIImage *image= [UIImage imageNamed:imageName];
// NSString *imageName = [NSString stringWithFormat:@"05产品库-详情_03" ];
// UIImage *image= [UIImage imageNamed:imageName];
self.dataArray=[[NSMutableArray alloc]init];
self.productModelArray=[[NSMutableArray alloc]init];
......@@ -67,7 +67,7 @@
//单次点击
-(void)clicked:(UIButton*)sender
{
NSLog(@"%d",(sender.tag));
NSLog(@"%ld",(long)(sender.tag));
if ([self.delegate respondsToSelector:@selector(resetSubProductImage:productModel:)]) {
[self.delegate resetSubProductImage:sender.imageView.image productModel:[self.productModelArray objectAtIndex:sender.tag-100]];
......
......@@ -133,7 +133,7 @@
}
}
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%d)",self.selectTagArray.count] forState:UIControlStateNormal];
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%lu)",(unsigned long)self.selectTagArray.count] forState:UIControlStateNormal];
self.isAllSelected=YES;
}else
{
......@@ -165,16 +165,16 @@
[self.selectTagArray removeObject:str];
}
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%d)",self.selectTagArray.count] forState:UIControlStateNormal];
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%lu)",(unsigned long)self.selectTagArray.count] forState:UIControlStateNormal];
}
[self.shoppingTableView reloadData];
}
//选择
-(void)selfctAtIndexpath:(CustomShopingSeclectButton *)sender
{
if ([self.selectTagArray containsObject:[NSString stringWithFormat:@"%d",sender.tag]]) {
if ([self.selectTagArray containsObject:[NSString stringWithFormat:@"%ld",(long)sender.tag]]) {
[sender setBackgroundImage:[UIImage imageNamed:@"box-副本"] forState:UIControlStateNormal];
[self.selectTagArray removeObject:[NSString stringWithFormat:@"%d",sender.tag]];
[self.selectTagArray removeObject:[NSString stringWithFormat:@"%ld",(long)sender.tag]];
[self.AddArray removeObjectAtIndex:sender.tag];
if (self.isAllSelected) {
[ self.allSelectBtn setBackgroundImage:[UIImage imageNamed:@"box-副本"] forState:UIControlStateNormal];
......@@ -184,7 +184,7 @@
}else
{
[sender setBackgroundImage:[UIImage imageNamed:@"bg"] forState:UIControlStateNormal];
[self.selectTagArray addObject:[NSString stringWithFormat:@"%d",sender.tag]];
[self.selectTagArray addObject:[NSString stringWithFormat:@"%ld",(long)sender.tag]];
[self.AddArray addObject:[self.productModelArray objectAtIndex:sender.tag]];
if (!self.isAllSelected&&self.selectTagArray.count==self.self.productModelArray.count ) {
[ self.allSelectBtn setBackgroundImage:[UIImage imageNamed:@"bg"] forState:UIControlStateNormal];
......@@ -192,7 +192,7 @@
}
}
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%d)",self.selectTagArray.count] forState:UIControlStateNormal];
[self.confirmAddBtn setTitle:[NSString stringWithFormat:@"确认添加(%lu)",(unsigned long)self.selectTagArray.count] forState:UIControlStateNormal];
}
//第一种排序 倒序排列
......@@ -233,7 +233,7 @@
shopCar.count = @"";
for (int i=0; i<self.shoppingTableView.visibleCells.count; i++) {
ShoppingCell *cell=[self.shoppingTableView.visibleCells objectAtIndex:i];
if ( [self.selectTagArray containsObject:[NSString stringWithFormat:@"%d",cell.selectedButton.tag]] ) {
if ( [self.selectTagArray containsObject:[NSString stringWithFormat:@"%ld",(long)cell.selectedButton.tag]] ) {
TOGoodsEntity *model=cell.customGoods.tOGoodsEntity;
if (![shopCar.count isEqualToString:@""]&&![shopCar.goodsId isEqualToString:@""]) {
shopCar.goodsId=[NSString stringWithFormat:@"%@,%@",shopCar.goodsId,model.fid];
......
......@@ -61,7 +61,6 @@
29360C311CDDC487002A5D89 /* ScreeningView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 29360C301CDDC487002A5D89 /* ScreeningView.xib */; };
2936F28C1D014147007CA67C /* sceneScreeningCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2936F28B1D014147007CA67C /* sceneScreeningCollectionViewCell.m */; };
2936F28F1D0141FD007CA67C /* ProductScreeningTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2936F28E1D0141FD007CA67C /* ProductScreeningTableViewCell.m */; };
2936F2931D016EB2007CA67C /* SceneSelectedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2936F2921D016EB2007CA67C /* SceneSelectedModel.m */; };
2936F2961D017BBD007CA67C /* GoodsImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2936F2951D017BBD007CA67C /* GoodsImageView.m */; };
2936F29A1D01868E007CA67C /* ShareGoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2936F2981D01868E007CA67C /* ShareGoodsViewController.m */; };
2936F29B1D01868E007CA67C /* ShareGoodsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2936F2991D01868E007CA67C /* ShareGoodsViewController.xib */; };
......@@ -266,8 +265,6 @@
2936F28B1D014147007CA67C /* sceneScreeningCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = sceneScreeningCollectionViewCell.m; sourceTree = "<group>"; };
2936F28D1D0141FD007CA67C /* ProductScreeningTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductScreeningTableViewCell.h; sourceTree = "<group>"; };
2936F28E1D0141FD007CA67C /* ProductScreeningTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductScreeningTableViewCell.m; sourceTree = "<group>"; };
2936F2911D016EB2007CA67C /* SceneSelectedModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SceneSelectedModel.h; sourceTree = "<group>"; };
2936F2921D016EB2007CA67C /* SceneSelectedModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SceneSelectedModel.m; sourceTree = "<group>"; };
2936F2941D017BBD007CA67C /* GoodsImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GoodsImageView.h; sourceTree = "<group>"; };
2936F2951D017BBD007CA67C /* GoodsImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GoodsImageView.m; sourceTree = "<group>"; };
2936F2971D01868E007CA67C /* ShareGoodsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareGoodsViewController.h; sourceTree = "<group>"; };
......@@ -813,15 +810,6 @@
name = view;
sourceTree = "<group>";
};
2936F2901D016E91007CA67C /* model */ = {
isa = PBXGroup;
children = (
2936F2911D016EB2007CA67C /* SceneSelectedModel.h */,
2936F2921D016EB2007CA67C /* SceneSelectedModel.m */,
);
name = model;
sourceTree = "<group>";
};
2942F8A21CDD7ECD005B377E /* controller */ = {
isa = PBXGroup;
children = (
......@@ -987,7 +975,6 @@
29808A611CFEC287001D1020 /* Experiencecentre */ = {
isa = PBXGroup;
children = (
2936F2901D016E91007CA67C /* model */,
2936F2861D014094007CA67C /* view */,
29808A681CFED712001D1020 /* Controller */,
29808A651CFED6E5001D1020 /* Scene */,
......@@ -1742,7 +1729,6 @@
29BB277D1CD9DFCB009A0813 /* CustomerManagementViewController.m in Sources */,
2962D06D1CD1A43A0058829D /* ClientViewController.m in Sources */,
29A8D3981CD85A58004D558F /* ClientdetailsViewController.m in Sources */,
2936F2931D016EB2007CA67C /* SceneSelectedModel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -57,6 +57,17 @@
*/
@property (nonatomic,strong) UIView *lineView;
/**
* 选中的场景
*/
@property (nonatomic,strong) NSArray *sceneArray;
/**
* 选中的产品
*/
@property (nonatomic,strong) NSArray *productArray;
- (void)saveContext;
- (NSURL *)applicationDocumentsDirectory;
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window;
......
......@@ -750,7 +750,7 @@
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="firstcell" rowHeight="84" id="XgA-9w-ut9" customClass="OrderInformationTableViewCell">
<rect key="frame" x="0.0" y="49.5" width="1024" height="84"/>
<rect key="frame" x="0.0" y="113.5" width="1024" height="84"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="XgA-9w-ut9" id="BWi-jv-OOH">
<rect key="frame" x="0.0" y="0.0" width="1024" height="83.5"/>
......@@ -823,7 +823,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="secondcell" rowHeight="110" id="rIO-yd-hh7" customClass="PersonInformationTableViewCell">
<rect key="frame" x="0.0" y="133.5" width="1024" height="110"/>
<rect key="frame" x="0.0" y="197.5" width="1024" height="110"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="rIO-yd-hh7" id="mn8-g0-Zqo">
<rect key="frame" x="0.0" y="0.0" width="1024" height="109.5"/>
......@@ -900,7 +900,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="thirdcell" rowHeight="90" id="PfN-24-v5t" customClass="GoodsInformationTableViewCell">
<rect key="frame" x="0.0" y="243.5" width="1024" height="90"/>
<rect key="frame" x="0.0" y="307.5" width="1024" height="90"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PfN-24-v5t" id="2Je-94-WVY">
<rect key="frame" x="0.0" y="0.0" width="1024" height="89.5"/>
......@@ -957,7 +957,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="fourthcell" rowHeight="80" id="47T-H0-tG7" customClass="CommodityListTableViewCell">
<rect key="frame" x="0.0" y="333.5" width="1024" height="80"/>
<rect key="frame" x="0.0" y="397.5" width="1024" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="47T-H0-tG7" id="zXR-bC-Wdh">
<rect key="frame" x="0.0" y="0.0" width="1024" height="79.5"/>
......@@ -1029,7 +1029,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="sixthcell" rowHeight="50" id="PNT-Fy-4Hi" customClass="AllpriceTableViewCell">
<rect key="frame" x="0.0" y="413.5" width="1024" height="50"/>
<rect key="frame" x="0.0" y="477.5" width="1024" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="PNT-Fy-4Hi" id="PxE-0c-Zdt">
<rect key="frame" x="0.0" y="0.0" width="1024" height="49.5"/>
......@@ -1190,7 +1190,7 @@
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="productcell" id="J5m-0M-uqb" customClass="ProductCollectionViewCell">
<rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
<rect key="frame" x="0.0" y="64" width="300" height="300"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
......@@ -3209,10 +3209,17 @@
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="默认场景" id="GBJ-e6-U4h">
<view contentMode="scaleToFill" id="n1A-v4-tFR">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="默认场景" id="GBJ-e6-U4h">
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="WBE-oY-ZzS">
<rect key="frame" x="38" y="94" width="45" height="45"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
......@@ -3342,6 +3349,7 @@
<outlet property="productScrollview" destination="QNa-8Y-xCl" id="CVO-zE-ciB"/>
<outlet property="productSelectedButton" destination="Liv-2f-f1g" id="sDd-OF-ScS"/>
<outlet property="returnButton" destination="WBE-oY-ZzS" id="njb-qK-rAa"/>
<outlet property="sceneBackView" destination="n1A-v4-tFR" id="jLo-o3-yqQ"/>
<outlet property="sceneImageView" destination="GBJ-e6-U4h" id="f8j-jh-W3E"/>
<outlet property="sceneLayout" destination="ukF-ck-NMa" id="acb-ay-f4Y"/>
<outlet property="sceneScrollview" destination="rtu-sJ-bqU" id="66G-IT-ijv"/>
......
......@@ -7,11 +7,20 @@
//
#import "BaseViewController.h"
#import "TOGoodsEntityModel.h"
#import "SceneListModel.h"
@interface ExperienceCentreViewController : BaseViewController
/**
* 场景背景
*/
@property (weak, nonatomic) IBOutlet UIView *sceneBackView;
/**
* 场景图片
*/
......
......@@ -10,7 +10,6 @@
#import "SceneViewController.h"
#import "sceneScreeningCollectionViewCell.h"
#import "ProductScreeningTableViewCell.h"
#import "SceneSelectedModel.h"
#import "GoodsImageView.h"
#import "ShareGoodsViewController.h"
......@@ -19,7 +18,7 @@
#define RIGHTWIDTH 200
#define TOPWIDTH 300
@interface ExperienceCentreViewController ()<AddImagesDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate>
@interface ExperienceCentreViewController ()<AddImagesDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UITableViewDelegate,UITableViewDataSource,UIGestureRecognizerDelegate,SharePicturedelegate>
/**
* 选中场景数据
......@@ -31,6 +30,11 @@
*/
@property (nonatomic,strong) NSMutableArray *productDatasArray;
/**
* 需要分享的商品数组
*/
@property (nonatomic,strong) NSMutableArray *shareGoodsArray;
@end
......@@ -58,6 +62,15 @@
}
- (NSMutableArray *)shareGoodsArray
{
if (!_shareGoodsArray) {
_shareGoodsArray = [NSMutableArray array];
}
return _shareGoodsArray;
}
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -90,11 +103,11 @@
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
sceneScreeningCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"sceneScreeningCollectionViewCell" forIndexPath:indexPath];
SceneSelectedModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
cell.selectedScrenImageView.image = [model sceneImage];
SceneListModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
[cell.selectedScrenImageView sd_setImageWithURL:[NSURL URLWithString:model.pricure] placeholderImage:REPLACEIMAGE];
cell.selectedScrenImageView.layer.masksToBounds = YES;
cell.selectedScrenImageView.layer.cornerRadius = kCornerRadius;
if (model.isSelectedState) {
if (model.isSelectedSate) {
cell.selectedScrenImageView.layer.borderWidth = 2.0f;
cell.selectedScrenImageView.layer.borderColor = kMainBlueColor.CGColor;
}else
......@@ -106,12 +119,12 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
for (SceneSelectedModel *model in self.sceneDatasArray) {
model.isSelectedState = NO;
for (SceneListModel *model in self.sceneDatasArray) {
model.isSelectedSate = NO;
}
SceneSelectedModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
model.isSelectedState = YES;
self.sceneImageView.image = [model sceneImage];
SceneListModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
model.isSelectedSate = YES;
[self.sceneImageView sd_setImageWithURL:[NSURL URLWithString:model.pricure] placeholderImage:REPLACEIMAGE];
[self.sceneScrollview reloadData];
}
......@@ -128,7 +141,7 @@
ProductScreeningTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ProductScreeningTableViewCell" forIndexPath:indexPath];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
SceneSelectedModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.row];
TOGoodsEntityModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.row];
if (model.isSelectedState) {
cell.selectedGoodsImageView.layer.borderWidth = 2.0f;
cell.selectedGoodsImageView.layer.borderColor = kMainBlueColor.CGColor;
......@@ -136,7 +149,8 @@
{
cell.selectedGoodsImageView.layer.borderWidth = 0;
}
cell.selectedGoodsImageView.image = [model sceneImage];
NSArray *imags = [model.pictures componentsSeparatedByString:@","];
[cell.selectedGoodsImageView sd_setImageWithURL:[NSURL URLWithString:[imags firstObject]] placeholderImage:REPLACEIMAGE];
return cell;
}
......@@ -150,20 +164,26 @@
{
ProductScreeningTableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
TOGoodsEntityModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.row];
CGRect cellRect = [cell convertRect:cell.bounds toView:self.view];
GoodsImageView *imageView = [[GoodsImageView alloc]initWithFrame:cellRect];
imageView.model = model;
[imageView setDelectedBlock:^(TOGoodsEntityModel *delectedModel) {
[self.shareGoodsArray removeObject:delectedModel];
}];
imageView.userInteractionEnabled = YES;
[UIView animateWithDuration:0.5 animations:^{
imageView.frame = CGRectMake(ScreenWidth/2, ScreenHeight/2, 266, 200);
imageView.frame = CGRectMake((ScreenWidth-266)/2, (ScreenHeight-200)/2, 266, 200);
}];
for (SceneSelectedModel *model in self.productDatasArray) {
for (TOGoodsEntityModel *model in self.productDatasArray) {
model.isSelectedState = NO;
}
SceneSelectedModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.row];
model.isSelectedState = YES;
imageView.image = [model sceneImage];
[self.view addSubview:imageView];
[self.shareGoodsArray addObject:model];
NSArray *imags = [model.pictures componentsSeparatedByString:@","];
[imageView sd_setImageWithURL:[NSURL URLWithString:[imags firstObject]] placeholderImage:REPLACEIMAGE];
[self.sceneBackView addSubview:imageView];
[self.productScrollview reloadData];
}
......@@ -185,6 +205,14 @@
- (IBAction)ShareButtonClickAction:(UIButton *)sender {
ShareGoodsViewController *shareController = [[ShareGoodsViewController alloc]init];
//商品id拼接
NSMutableString *goodsID = [[NSMutableString alloc]init];
for (TOGoodsEntityModel *model in self.shareGoodsArray) {
[goodsID appendFormat:@"%@,",model.fid];
}
shareController.goodsIds = goodsID;
shareController.shareImage = [self capture];
shareController.delegate = self;
shareController.preferredContentSize = CGSizeMake(290, 120);
shareController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popover = shareController.popoverPresentationController;
......@@ -197,13 +225,23 @@
#pragma mark -拍照
- (IBAction)TakingPhotoButtonClickAction:(UIButton *)sender {
}
}
#pragma mark -截屏
- (UIImage *)capture
{
// 创建一个context
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
//把当前的全部画面导入到栈顶context中并进行渲染
[self.sceneBackView.layer renderInContext:UIGraphicsGetCurrentContext()];
// 从当前context中创建一个新图片
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
// 使当前的context出堆栈
UIGraphicsEndImageContext();
return img;
}
......@@ -296,12 +334,13 @@
#pragma mark -AddImagesDelegate选中图片
- (void)SelectedImages:(UIImage *)image withisScene:(BOOL)isScene returnResponse:(void (^)(BOOL))isThere
- (void)SelectedImageswithModel:(JSONModel *)model withisScene:(BOOL)isScene returnResponse:(void (^)(BOOL))isThere
{
if (isScene) {
for (SceneSelectedModel *objc in self.sceneDatasArray) {
if ([objc.sceneImage isEqual:image]) {
//场景
SceneListModel *sceneModel = (SceneListModel *)model;
for (SceneListModel *objc in self.sceneDatasArray) {
if ([objc.fid isEqualToString:sceneModel.fid]) {
isThere(YES);
[self.sceneDatasArray removeObject:objc];
[self.sceneScrollview reloadData];
......@@ -309,15 +348,16 @@
}
}
isThere(NO);
SceneSelectedModel *model = [[SceneSelectedModel alloc]init];
model.sceneImage = image;
model.isSelectedState = NO;
[self.sceneDatasArray addObject:model];
sceneModel.isSelectedSate = NO;
[self.sceneDatasArray addObject:sceneModel];
SHARED_APPDELEGATE.sceneArray = self.sceneDatasArray;
}else
{
for (SceneSelectedModel *objc in self.productDatasArray) {
if ([objc.sceneImage isEqual:image]) {
//产品
TOGoodsEntityModel *goodsModel = (TOGoodsEntityModel *)model;
for (TOGoodsEntityModel *objc in self.productDatasArray) {
if ([objc.fid isEqualToString:goodsModel.fid]) {
isThere(YES);
[self.productDatasArray removeObject:objc];
[self.productScrollview reloadData];
......@@ -325,10 +365,9 @@
}
}
isThere(NO);
SceneSelectedModel *model = [[SceneSelectedModel alloc]init];
model.sceneImage = image;
model.isSelectedState = NO;
[self.productDatasArray addObject:model];
goodsModel.isSelectedState = NO;
[self.productDatasArray addObject:goodsModel];
SHARED_APPDELEGATE.productArray = self.productDatasArray;
}
}
......@@ -349,6 +388,38 @@
#pragma mark ---SharePicturedelegate
#pragma mark -上传图片进度
- (void)UploadImageProgress:(double)progress
{
dispatch_async(dispatch_get_main_queue(), ^{
[self ShowProgressView:progress];
});
}
#pragma mark -上传图片完成
- (void)UploadImageSuccess
{
dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.labelText = @"上传完成";
[self RemoveMBProgressHUDLoding];
});
}
#pragma mark -上传图片失败
- (void)UploadImageFailue
{
dispatch_async(dispatch_get_main_queue(), ^{
self.TCHud.labelText = @"上传失败";
[self RemoveMBProgressHUDLoding];
});
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
......
......@@ -7,7 +7,20 @@
//
#import <UIKit/UIKit.h>
#import "TOGoodsEntityModel.h"
@interface GoodsImageView : UIImageView<UIGestureRecognizerDelegate>
/**
* 数据源
*/
@property (nonatomic,strong) TOGoodsEntityModel *model;
/**
* 长按删除
*/
@property (nonatomic,copy) void(^delectedBlock)(TOGoodsEntityModel *model);
@end
......@@ -69,6 +69,9 @@
#pragma mark -长按
- (void)LongPressAction:(UILongPressGestureRecognizer *)longPress
{
if (self.delectedBlock) {
self.delectedBlock(self.model);
}
[self removeFromSuperview];
}
......
//
// SceneSelectedModel.h
// Lighting
//
// Created by 曹云霄 on 16/6/3.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import <JSONModel/JSONModel.h>
@interface SceneSelectedModel : JSONModel
/**
* 图片
*/
@property (nonatomic,strong) UIImage *sceneImage;
/**
* 选中状态
*/
@property (nonatomic,assign) BOOL isSelectedState;
@end
//
// SceneSelectedModel.m
// Lighting
//
// Created by 曹云霄 on 16/6/3.
// Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//
#import "SceneSelectedModel.h"
@implementation SceneSelectedModel
@end
......@@ -8,7 +8,6 @@
#import "BaseViewController.h"
/**
* 选中场景或者商品回传
*/
......@@ -17,7 +16,7 @@
@required
//增加图片
- (void)SelectedImages:(UIImage *)image withisScene:(BOOL)isScene returnResponse:(void(^)(BOOL boolValue))isThere;
- (void)SelectedImageswithModel:(JSONModel *)model withisScene:(BOOL)isScene returnResponse:(void(^)(BOOL boolValue))isThere;
//刷新
- (void)RefreshSceneAndProduct:(BOOL)isScene;
//删除图片
......
......@@ -335,6 +335,13 @@
newModel.isSelectedSate = NO;
[self.sceneDatasArray addObject:newModel];
}
for (SceneListModel *model in SHARED_APPDELEGATE.sceneArray) {
for (SceneListModel *sceneModel in self.sceneDatasArray) {
if ([model.fid isEqualToString:sceneModel.fid]) {
sceneModel.isSelectedSate = YES;
}
}
}
[self.sceneOrProductClollectionView reloadData];
}
......@@ -484,7 +491,7 @@
weakSelf.sceneOrProductClollectionView.emptyDataSetSource = weakSelf;
if (remove) {
[self.productDatasArray removeAllObjects];
[weakSelf.productDatasArray removeAllObjects];
}
for (TOGoodsEntity *model in response.goodsEntity) {
......@@ -531,6 +538,13 @@
newModel.isSelectedState = NO;
[weakSelf.productDatasArray addObject:newModel];
}
for (TOGoodsEntityModel *model in SHARED_APPDELEGATE.productArray) {
for (TOGoodsEntityModel *productModel in weakSelf.productDatasArray) {
if ([model.fid isEqualToString:productModel.fid]) {
productModel.isSelectedState = YES;
}
}
}
[weakSelf.sceneOrProductClollectionView reloadData];
}];
}
......@@ -775,24 +789,23 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
__weak typeof(self) weakSelf = self;
__weak typeof(self)weakSelf = self;
[self emptyModel];
if (self.isScene) {
ScreeningCollectionViewCell *cell = (ScreeningCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
CGPoint startPoint = [cell convertPoint:cell.sceneImageView.center toView:self.sceneOrProductClollectionView.window];
if ([self.delegate respondsToSelector:@selector(SelectedImages:withisScene:returnResponse:)]) {
[self.delegate SelectedImages:cell.sceneImageView.image withisScene:self.isScene returnResponse:^(BOOL boolValue) {
if ([self.delegate respondsToSelector:@selector(SelectedImageswithModel:withisScene:returnResponse:)]) {
SceneListModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
[self.delegate SelectedImageswithModel:model withisScene:self.isScene returnResponse:^(BOOL boolValue) {
//判断选中的图片是否存在
if (!boolValue) {
[weakSelf StartAddShoppingCarAnimationWithimage:[cell.sceneImageView image] withStartpoint:startPoint withSize:cell.mj_size];
SceneListModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
model.isSelectedSate = YES;
[self.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
[weakSelf.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
}else
{
SceneListModel *model = [self.sceneDatasArray objectAtIndex_opple:indexPath.item];
model.isSelectedSate = NO;
[self.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
[weakSelf.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
}
}];
}
......@@ -801,19 +814,18 @@
ProductScreeningCollectionViewCell *cell = (ProductScreeningCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
CGPoint startPoint = [cell convertPoint:cell.goodsImageView.center toView:self.sceneOrProductClollectionView.window];
if ([self.delegate respondsToSelector:@selector(SelectedImages:withisScene:returnResponse:)]) {
[self.delegate SelectedImages:cell.goodsImageView.image withisScene:self.isScene returnResponse:^(BOOL boolValue) {
if ([self.delegate respondsToSelector:@selector(SelectedImageswithModel:withisScene:returnResponse:)]) {
GoodsCategoryModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.item];
[self.delegate SelectedImageswithModel:model withisScene:self.isScene returnResponse:^(BOOL boolValue) {
//判断图片是否存在
if (!boolValue) {
[self StartAddShoppingCarAnimationWithimage:[cell.goodsImageView image] withStartpoint:startPoint withSize:cell.mj_size];
GoodsCategoryModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.item];
[weakSelf StartAddShoppingCarAnimationWithimage:[cell.goodsImageView image] withStartpoint:startPoint withSize:cell.mj_size];
model.isSelectedState = YES;
[self.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
[weakSelf.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
}else
{
GoodsCategoryModel *model = [self.productDatasArray objectAtIndex_opple:indexPath.item];
model.isSelectedState = NO;
[self.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
[weakSelf.sceneOrProductClollectionView reloadItemsAtIndexPaths:@[indexPath]];
}
}];
}
......
......@@ -10,6 +10,8 @@
@protocol SharePicturedelegate <NSObject>
@optional
//回调
- (void)ShareProductImage:(UIImage *)image ;
......
......@@ -28,25 +28,23 @@
[self dismissViewControllerAnimated:YES completion:nil];
NSData *imageData = UIImageJPEGRepresentation(TCImage(@"登录"), 1.0);
NSData *imageData = UIImageJPEGRepresentation(self.shareImage, 0.5);
// 0b44439e5504e371015504f73d4f0025,0b44439e5504e371015504feae270028
NSDictionary *parameterDict = [NSDictionary dictionaryWithObjectsAndKeys:@"0b44439e5504e371015504f73d4f0025,0b44439e5504e371015504feae270028",@"goodsIds",@"",@"title",@"",@"remark",nil];
NSDictionary *parameterDict = [NSDictionary dictionaryWithObjectsAndKeys:self.goodsIds,@"goodsIds",@"",@"title",@"",@"remark",nil];
//上传图片
[[NetworkRequestClassManager Manager] UploadImageWithURL:[NSString stringWithFormat:@"%@%@",ServerAddress,@"/system/shareGoods"] WithRequestType:0 WithImageDatas:imageData WithParameter:parameterDict WithReturnValueBlock:^(id returnValue) {
if ([returnValue[@"code"] isEqualToNumber:@0]) {
UMSocialUrlResource *resource = [[UMSocialUrlResource alloc]init];
[resource setResourceType:UMSocialUrlResourceTypeImage url:@"http://139.196.195.30:8090/opple-web/temp2/16052615120001.jpg"];
NSString *shareWeb = returnValue[@"data"][@"url"];
switch (sender.tag) {
case 101: //微信好友
case 100: //微信好友
{//自定义样式
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[UMSocialData defaultData].extConfig.wechatSessionData.url = shareWeb;
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:ShareTitle image:nil location:nil urlResource:resource presentedController:self completion:^(UMSocialResponseEntity *response){
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatSession] content:ShareTitle image:self.shareImage location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) {
[self SuccessMBProgressView:@"分享微信好友成功"];
......@@ -55,11 +53,11 @@
}
break;
case 102://微信朋友圈
case 101://微信朋友圈
{
//使用UMShareToWechatSession,UMShareToWechatTimeline,UMShareToWechatFavorite分别代表微信好友、微信朋友圈、微信收藏
[UMSocialData defaultData].extConfig.wechatTimelineData.url = shareWeb;
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline] content:ShareTitle image:nil location:nil urlResource:resource presentedController:self completion:^(UMSocialResponseEntity *response){
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToWechatTimeline] content:ShareTitle image:self.shareImage location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *response){
if (response.responseCode == UMSResponseCodeSuccess) {
[self SuccessMBProgressView:@"分享微信朋友圈成功"];
......@@ -67,12 +65,12 @@
}];
}
break;
case 103://新浪微博
case 102://新浪微博
{
//自定义分享样式
[UMSocialData defaultData].extConfig.sinaData.shareText = [NSString stringWithFormat:@"%@%@",@"欧普照明",shareWeb];
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToSina] content:ShareTitle image:nil location:nil urlResource:resource presentedController:self completion:^(UMSocialResponseEntity *shareResponse){
[[UMSocialDataService defaultDataService] postSNSWithTypes:@[UMShareToSina] content:ShareTitle image:self.shareImage location:nil urlResource:nil presentedController:self completion:^(UMSocialResponseEntity *shareResponse){
if (shareResponse.responseCode == UMSResponseCodeSuccess) {
[self SuccessMBProgressView:@"分享新浪微博成功"];
......
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