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

优化场景库图片下标误差

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