Commit 0029765a authored by 曹云霄's avatar 曹云霄

优化场景库图片下标误差

parent 6a4e5533
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
@property (nonatomic,assign) BOOL isProductLibrary; @property (nonatomic,assign) BOOL isProductLibrary;
/** /**
* 应该现在的下标 * 应该现在的下标
*/ */
@property (nonatomic,assign) NSInteger currentindex; @property (nonatomic,assign) NSInteger currentIndex;
@end @end
...@@ -23,10 +23,6 @@ ...@@ -23,10 +23,6 @@
*/ */
@property (nonatomic,strong) UIButton *backButton; @property (nonatomic,strong) UIButton *backButton;
/**
* 保存当前下标
*/
@property (nonatomic,assign) NSInteger currentIndex;
@end @end
...@@ -34,8 +30,6 @@ ...@@ -34,8 +30,6 @@
static NSString * const reuseIdentifier = @"Cell"; static NSString * const reuseIdentifier = @"Cell";
#pragma mark -初始化 #pragma mark -初始化
- (instancetype)init - (instancetype)init
{ {
...@@ -52,8 +46,6 @@ static NSString * const reuseIdentifier = @"Cell"; ...@@ -52,8 +46,6 @@ static NSString * const reuseIdentifier = @"Cell";
return [super initWithCollectionViewLayout:layout]; return [super initWithCollectionViewLayout:layout];
} }
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
...@@ -61,18 +53,15 @@ static NSString * const reuseIdentifier = @"Cell"; ...@@ -61,18 +53,15 @@ static NSString * const reuseIdentifier = @"Cell";
[self CreateBackView]; [self CreateBackView];
} }
#pragma amrk 返回View #pragma amrk 返回View
- (void)CreateBackView - (void)CreateBackView
{ {
//产品列表调用 //产品列表调用
if (self.isProductLibrary) { if (self.isProductLibrary) {
self.backButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
self.backButton.frame = CGRectMake(30, 10, 100, 64); self.backButton.frame = CGRectMake(30, 10, 100, 64);
[self.backButton setImage:TCImage(@"2-副本") forState:UIControlStateNormal]; [self.backButton setImage:TCImage(@"2-副本") forState:UIControlStateNormal];
[self.backButton addTarget:self action:@selector(BackButtonClick) forControlEvents:UIControlEventTouchUpInside]; [self.backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.backButton]; [self.view addSubview:self.backButton];
}else//场景列表调用 }else//场景列表调用
...@@ -84,7 +73,7 @@ static NSString * const reuseIdentifier = @"Cell"; ...@@ -84,7 +73,7 @@ static NSString * const reuseIdentifier = @"Cell";
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(30, 0, 100, 64); backButton.frame = CGRectMake(30, 0, 100, 64);
[backButton setImage:TCImage(@"quanping") forState:UIControlStateNormal]; [backButton setImage:TCImage(@"quanping") forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(BackButtonClick) forControlEvents:UIControlEventTouchUpInside]; [backButton addTarget:self action:@selector(backButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self.backView addSubview:backButton]; [self.backView addSubview:backButton];
//体验中心 //体验中心
...@@ -95,31 +84,24 @@ static NSString * const reuseIdentifier = @"Cell"; ...@@ -95,31 +84,24 @@ static NSString * const reuseIdentifier = @"Cell";
tiYanCenterButton.layer.borderWidth = 1; tiYanCenterButton.layer.borderWidth = 1;
tiYanCenterButton.layer.borderColor = [UIColor whiteColor].CGColor; tiYanCenterButton.layer.borderColor = [UIColor whiteColor].CGColor;
[tiYanCenterButton setTitle:@"体验中心" forState:UIControlStateNormal]; [tiYanCenterButton setTitle:@"体验中心" forState:UIControlStateNormal];
[tiYanCenterButton addTarget:self action:@selector(GotoTiYanCenterButtonClick) forControlEvents:UIControlEventTouchUpInside]; [tiYanCenterButton addTarget:self action:@selector(gotoTiYanCenterButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self.backView addSubview:tiYanCenterButton]; [self.backView addSubview:tiYanCenterButton];
} }
[self.collectionView setContentOffset:CGPointMake(ScreenWidth*self.currentindex, 0)]; [self.collectionView setContentOffset:CGPointMake(ScreenWidth*self.currentIndex, 0)];
} }
#pragma mark -返回 #pragma mark -返回
- (void)BackButtonClick - (void)backButtonClick
{ {
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
} }
#pragma mark -体验中心 #pragma mark -体验中心
- (void)GotoTiYanCenterButtonClick - (void)gotoTiYanCenterButtonClick
{ {
ExperienceCentreViewController *ExperienceCenter = [[BaseViewController getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ExperienceCentre"]; ExperienceCentreViewController *ExperienceCenter = [[BaseViewController getMainStoryboardClass] instantiateViewControllerWithIdentifier:@"ExperienceCentre"];
TOSceneEntity *sceneModel = [self.datasArray objectAtIndex_opple:self.currentIndex]; TOSceneEntity *sceneModel = [self.datasArray objectAtIndex_opple:self.currentIndex];
SceneListModel *model = [[SceneListModel alloc]init]; SceneListModel *model = [[SceneListModel alloc] initWithDictionary:[sceneModel toDictionary] error:nil];
model.fid = sceneModel.fid;
model.sceneCode = sceneModel.sceneCode;
model.name = sceneModel.name;
model.pricure = sceneModel.pricure;
model.category = sceneModel.category;
model.style = sceneModel.style;
model.space = sceneModel.space;
model.isSelectedSate = YES; model.isSelectedSate = YES;
[ExperienceCenter.sceneDatasArray addObject:model]; [ExperienceCenter.sceneDatasArray addObject:model];
ExperienceCenter.boolValue = YES; ExperienceCenter.boolValue = YES;
...@@ -167,43 +149,32 @@ static NSString * const reuseIdentifier = @"Cell"; ...@@ -167,43 +149,32 @@ static NSString * const reuseIdentifier = @"Cell";
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{ {
if (self.isProductLibrary) { if (self.isProductLibrary) {
if (self.backButton.frame.origin.y == 10) { if (self.backButton.frame.origin.y == 10) {
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
CGRect frame = self.backButton.frame; CGRect frame = self.backButton.frame;
frame.origin.y = -64; frame.origin.y = -64;
self.backButton.frame = frame; self.backButton.frame = frame;
}]; }];
}else if (self.backButton.frame.origin.y == -64) }else if (self.backButton.frame.origin.y == -64)
{ {
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
CGRect frame = self.backButton.frame; CGRect frame = self.backButton.frame;
frame.origin.y = 10; frame.origin.y = 10;
self.backButton.frame = frame; self.backButton.frame = frame;
}]; }];
} }
}else }else{
{
if (self.backView.frame.origin.y == 0) { if (self.backView.frame.origin.y == 0) {
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
CGRect frame = self.backView.frame; CGRect frame = self.backView.frame;
frame.origin.y = -64; frame.origin.y = -64;
self.backView.frame = frame; self.backView.frame = frame;
}]; }];
}else if (self.backView.frame.origin.y == -64) }else if (self.backView.frame.origin.y == -64)
{ {
[UIView animateWithDuration:0.3 animations:^{ [UIView animateWithDuration:0.3 animations:^{
CGRect frame = self.backView.frame; CGRect frame = self.backView.frame;
frame.origin.y = 0; frame.origin.y = 0;
self.backView.frame = frame; self.backView.frame = frame;
......
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
FullScreenViewController *fullScreenVC = [[FullScreenViewController alloc]init]; FullScreenViewController *fullScreenVC = [[FullScreenViewController alloc]init];
fullScreenVC.datasArray = self.imagesArray; fullScreenVC.datasArray = self.imagesArray;
fullScreenVC.isProductLibrary = YES; fullScreenVC.isProductLibrary = YES;
fullScreenVC.currentindex = self.imageIndex; fullScreenVC.currentIndex = self.imageIndex;
[self presentViewController:fullScreenVC animated:YES completion:nil]; [self presentViewController:fullScreenVC animated:YES completion:nil];
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
*/ */
@property (weak, nonatomic) IBOutlet UIButton *accordingStyle; @property (weak, nonatomic) IBOutlet UIButton *accordingStyle;
/** /**
* 背景View * 背景View
*/ */
...@@ -33,7 +32,6 @@ ...@@ -33,7 +32,6 @@
*/ */
@property (strong, nonatomic) ScreeningButton *styleButton; @property (strong, nonatomic) ScreeningButton *styleButton;
/** /**
* 房型按钮 * 房型按钮
*/ */
......
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
{ {
FullScreenViewController *fullScreenVC = [[FullScreenViewController alloc]init]; FullScreenViewController *fullScreenVC = [[FullScreenViewController alloc]init];
fullScreenVC.datasArray = self.responseArray; fullScreenVC.datasArray = self.responseArray;
fullScreenVC.currentindex = indexPath.row; fullScreenVC.currentIndex = indexPath.row;
[self presentViewController:fullScreenVC animated:YES completion:nil]; [self presentViewController:fullScreenVC animated:YES completion:nil];
} }
......
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