|
@@ -47,6 +47,7 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
|
|
|
@property (nonatomic) NSNumber *offSetTop;
|
|
|
@property (nonatomic) NSNumber *offSetLeft;
|
|
|
+@property (nonatomic) PanoramaOrientationViewDirectionEnum currentDirection;
|
|
|
|
|
|
@end
|
|
|
|
|
@@ -93,9 +94,10 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
}
|
|
|
|
|
|
- (void)direction:(PanoramaOrientationViewDirectionEnum)dir{
|
|
|
-
|
|
|
+ self.currentDirection = dir;
|
|
|
[self insertSubview:self.line atIndex:0];
|
|
|
self.line.hidden = YES;
|
|
|
+// self.label.hidden = YES;
|
|
|
[self.superV addSubview:self.label];
|
|
|
[self addSubview:self.whiteArrow];
|
|
|
[self.line mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
@@ -123,33 +125,34 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
}];
|
|
|
|
|
|
|
|
|
- [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- switch (dir) {
|
|
|
- case PanoramaOrientationViewLeft:
|
|
|
- case PanoramaOrientationViewRight: // 横
|
|
|
- {
|
|
|
- make.top.mas_equalTo(self.mas_bottom).offset(5);
|
|
|
- make.centerX.mas_equalTo(self.superV);
|
|
|
- make.height.offset(20);
|
|
|
- make.width.offset(160);
|
|
|
- self.label.verticalForm = NO;
|
|
|
- }
|
|
|
- break;
|
|
|
- case PanoramaOrientationViewUp:
|
|
|
- case PanoramaOrientationViewDown: // 上下
|
|
|
- {
|
|
|
- make.right.mas_equalTo(self.mas_left).offset(-5);
|
|
|
- make.centerY.mas_equalTo(self.superV);
|
|
|
- make.width.offset(20);
|
|
|
- make.height.offset(160);
|
|
|
- self.label.verticalForm = YES;
|
|
|
- }
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }];
|
|
|
+// [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// switch (dir) {
|
|
|
+// case PanoramaOrientationViewLeft:
|
|
|
+// case PanoramaOrientationViewRight: // 横
|
|
|
+// {
|
|
|
+// make.top.mas_equalTo(self.mas_bottom).offset(5);
|
|
|
+// make.centerX.mas_equalTo(self.superV);
|
|
|
+// make.height.offset(20);
|
|
|
+// make.width.offset(160);
|
|
|
+// self.label.verticalForm = NO;
|
|
|
+// }
|
|
|
+// break;
|
|
|
+// case PanoramaOrientationViewUp:
|
|
|
+// case PanoramaOrientationViewDown: // 上下
|
|
|
+// {
|
|
|
+// make.right.mas_equalTo(self.mas_left).offset(-5);
|
|
|
+// make.centerY.mas_equalTo(self.superV);
|
|
|
+// make.width.offset(20);
|
|
|
+// make.height.offset(160);
|
|
|
+// self.label.verticalForm = YES;
|
|
|
+// }
|
|
|
+// break;
|
|
|
+//
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }];
|
|
|
+ [self updatePromptLabel];
|
|
|
|
|
|
[self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
switch (dir) {
|
|
@@ -234,62 +237,301 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
[self layoutIfNeeded];
|
|
|
} completion:^(BOOL finished) {
|
|
|
self.line.hidden = NO;
|
|
|
+// self.label.hidden = NO;
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
-- (void)showImageWith:(UIImage * _Nullable)image dir:(PanoramaOrientationViewDirectionEnum)dir {
|
|
|
-// if (!image) {
|
|
|
-// dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
-// self.showImageView.image = nil;
|
|
|
-// });
|
|
|
-// return;
|
|
|
-// }
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- CGFloat imageWH = 0;
|
|
|
- if (image) {
|
|
|
- if (dir == PanoramaOrientationViewDown || dir == PanoramaOrientationViewUp) {
|
|
|
- imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
- } else {
|
|
|
- imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+- (void)updatePromptLabel {
|
|
|
+
|
|
|
+// self.backgroundColor = [UIColor redColor];
|
|
|
+// self.superV.backgroundColor = [UIColor yellowColor];
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(0);
|
|
|
+
|
|
|
+ switch (self.dir) {
|
|
|
+ case TgDirectionPortrait: {
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ switch (self.orginDir) {
|
|
|
+ case PanoramaOrientationViewLeft:
|
|
|
+ case PanoramaOrientationViewRight: // 横
|
|
|
+ {
|
|
|
+ make.top.mas_equalTo(self.mas_bottom).offset(5);
|
|
|
+ make.centerX.mas_equalTo(self.superV);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewUp:
|
|
|
+ case PanoramaOrientationViewDown: // 上下
|
|
|
+ {
|
|
|
+ make.right.mas_equalTo(self.mas_left).offset(-5);
|
|
|
+ make.centerY.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case TgDirectionDown: {
|
|
|
+ switch (self.orginDir) {
|
|
|
+ case PanoramaOrientationViewLeft: {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.mas_equalTo(self.mas_top).mas_offset(-20);
|
|
|
+ make.centerX.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewRight: // 横
|
|
|
+ {
|
|
|
+// self.label.transform = CGAffineTransformMakeRotation(0);
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(self.mas_right).offset(-60);
|
|
|
+ make.centerY.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewUp: {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI);
|
|
|
+
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.right.mas_equalTo(self.mas_left).offset(-5);
|
|
|
+ make.centerY.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewDown: // 上下
|
|
|
+ {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI);
|
|
|
+
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.right.mas_equalTo(self.mas_left).offset(-5);
|
|
|
+ make.centerY.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case TgDirectionLeft: {
|
|
|
+
|
|
|
+ switch (self.orginDir) {
|
|
|
+ case PanoramaOrientationViewLeft: {
|
|
|
+// self.label.transform = CGAffineTransformMakeRotation(0);
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(self.mas_left).mas_offset(60);
|
|
|
+ make.centerY.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewRight: // 横
|
|
|
+ {
|
|
|
+
|
|
|
+// self.label.transform = CGAffineTransformMakeRotation(0);
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(self.mas_left).mas_offset(60);
|
|
|
+ make.centerY.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewUp:{
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_equalTo(self.mas_bottom).offset(-60);
|
|
|
+ make.centerX.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewDown: // 上下
|
|
|
+ {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_equalTo(self.mas_bottom).offset(-60);
|
|
|
+ make.centerX.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case TgDirectionRight: {
|
|
|
+ switch (self.orginDir) {
|
|
|
+ case PanoramaOrientationViewLeft: {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(self.mas_right).offset(-60);
|
|
|
+ make.centerY.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewRight: // 横
|
|
|
+ {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(self.mas_right).offset(-60);
|
|
|
+ make.centerY.mas_equalTo(self);
|
|
|
+ make.height.offset(20);
|
|
|
+ make.width.offset(160);
|
|
|
+ self.label.verticalForm = NO;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewUp:{
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_equalTo(self.mas_bottom).offset(-60);
|
|
|
+ make.centerX.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case PanoramaOrientationViewDown: // 上下
|
|
|
+ {
|
|
|
+ self.label.transform = CGAffineTransformMakeRotation(-M_PI/2);
|
|
|
+ [self.label mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_equalTo(self.mas_bottom).offset(-60);
|
|
|
+ make.centerX.mas_equalTo(self.superV);
|
|
|
+ make.width.offset(20);
|
|
|
+ make.height.offset(160);
|
|
|
+ self.label.verticalForm = YES;
|
|
|
+ }];
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+- (void)showImageWith:(UIImage * _Nullable)image {
|
|
|
+
|
|
|
+// self.lastImage = image;
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ __block CGFloat imageWH = 0;
|
|
|
+ if (!image) {
|
|
|
self.offSetTop = @((120-38)/2);
|
|
|
self.offSetLeft = @((120-38)/2);
|
|
|
}
|
|
|
+
|
|
|
|
|
|
- // UIImage *resultImage = [self showDir:dir image:image];
|
|
|
self.showImageView.image = image;
|
|
|
[UIView animateWithDuration:.15 animations:^{
|
|
|
- switch (dir) {
|
|
|
- case PanoramaOrientationViewDown: {
|
|
|
+ if (self.dir == TgDirectionPortrait) {
|
|
|
+ if (self.orginDir == PanoramaOrientationViewDown) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
[self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.height.mas_equalTo(imageWH);
|
|
|
make.height.mas_lessThanOrEqualTo(self);
|
|
|
make.left.right.bottom.mas_equalTo(0);
|
|
|
}];
|
|
|
[self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.bottom.offset(-imageWH);
|
|
|
+ make.bottom.mas_offset(-imageWH);
|
|
|
make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
-// make.centerX.mas_equalTo(self);
|
|
|
}];
|
|
|
- }
|
|
|
- break;
|
|
|
- case PanoramaOrientationViewUp:{
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewUp) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
[self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.right.top.mas_equalTo(0);
|
|
|
make.height.mas_equalTo(imageWH);
|
|
|
make.height.mas_lessThanOrEqualTo(self);
|
|
|
}];
|
|
|
[self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.offset(imageWH);
|
|
|
-// make.centerX.mas_equalTo(self);
|
|
|
+ make.top.mas_offset(imageWH);
|
|
|
make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
|
|
|
}];
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case PanoramaOrientationViewRight: {
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewLeft) {
|
|
|
+
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.top.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_offset(imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewRight) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
[self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.width.mas_equalTo(imageWH);
|
|
|
make.width.mas_lessThanOrEqualTo(self);
|
|
@@ -297,15 +539,61 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
}];
|
|
|
|
|
|
[self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.offset(-imageWH);
|
|
|
-// make.centerY.mas_equalTo(self);
|
|
|
+ make.right.mas_offset(-imageWH);
|
|
|
make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
|
|
|
}];
|
|
|
}
|
|
|
- break;
|
|
|
+
|
|
|
+ } else if (self.dir == TgDirectionLeft) {
|
|
|
+ if (self.orginDir == PanoramaOrientationViewLeft) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.top.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_offset(imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewRight) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.mas_offset(-imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewUp) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.top.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
|
|
|
- case PanoramaOrientationViewLeft:{
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_offset(-imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewDown) {
|
|
|
+
|
|
|
+
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
[self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.width.mas_equalTo(imageWH);
|
|
|
make.width.mas_lessThanOrEqualTo(self);
|
|
@@ -313,18 +601,134 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
}];
|
|
|
|
|
|
[self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.offset(imageWH);
|
|
|
-// make.centerY.mas_equalTo(self);
|
|
|
+ make.left.mas_offset(imageWH);
|
|
|
make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
|
|
|
}];
|
|
|
}
|
|
|
+
|
|
|
+ } else if (self.dir == TgDirectionRight) {
|
|
|
+ if (self.orginDir == PanoramaOrientationViewLeft) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.mas_offset(-imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewRight) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.top.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_offset(imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewUp) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.top.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
|
|
|
- break;
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_offset(imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewDown) {
|
|
|
+
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.top.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
|
|
|
- default:
|
|
|
- break;
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_offset(-imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ }
|
|
|
+ } else if (self.dir == TgDirectionDown) {
|
|
|
+ if (self.orginDir == PanoramaOrientationViewLeft) {
|
|
|
+
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.top.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_offset(-imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewRight) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.width)/image.size.height;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(imageWH);
|
|
|
+ make.width.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.top.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_offset(imageWH);
|
|
|
+ make.top.mas_equalTo(self.offSetTop.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewUp) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ make.left.right.bottom.mas_equalTo(0);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.bottom.mas_offset(-imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+ }];
|
|
|
+ } else if (self.orginDir == PanoramaOrientationViewDown) {
|
|
|
+ if (image) {
|
|
|
+ imageWH = (PanoramaGuideViewWOrH * image.size.height)/image.size.width;
|
|
|
+ }
|
|
|
+ [self.showImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.right.top.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(imageWH);
|
|
|
+ make.height.mas_lessThanOrEqualTo(self);
|
|
|
+ }];
|
|
|
+ [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.mas_offset(imageWH);
|
|
|
+ make.left.mas_equalTo(self.offSetLeft.doubleValue);
|
|
|
+
|
|
|
+ }];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
[self setNeedsLayout];
|
|
|
[self layoutIfNeeded];
|
|
|
}];
|
|
@@ -341,109 +745,47 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
if (!self.showImageView.image) {
|
|
|
return;
|
|
|
}
|
|
|
- CGFloat imageWidth = self.showImageView.image.size.width;
|
|
|
- CGFloat imageHight = self.showImageView.image.size.height;
|
|
|
- if (dir == PanoramaOrientationViewDown || dir == PanoramaOrientationViewUp) {
|
|
|
- if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
- self.offSetLeft = @((120-38)/2);
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.bottom.offset(-(PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.centerX.mas_equalTo(self);
|
|
|
-// make.left.mas_offset(self.offSetLeft.doubleValue);
|
|
|
-// }];
|
|
|
- } else if (arrowDir == PanoramaArrowDirLeft) {
|
|
|
- self.offSetLeft = @(0);
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.bottom.offset(-(PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.left.mas_equalTo(self).mas_offset(10);
|
|
|
-// make.left.mas_offset(self.offSetLeft.doubleValue);
|
|
|
-//
|
|
|
-// }];
|
|
|
- } else if (arrowDir == PanoramaArrowDirRight) {
|
|
|
- self.offSetLeft = @(120-38);
|
|
|
-
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.bottom.offset(-(PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.right.mas_equalTo(self).mas_offset(-10);
|
|
|
-// make.left.mas_offset(self.offSetLeft.doubleValue);
|
|
|
-//
|
|
|
-// }];
|
|
|
+ if (self.dir == TgDirectionPortrait || self.dir == TgDirectionDown) {
|
|
|
+ if (dir == PanoramaOrientationViewDown || dir == PanoramaOrientationViewUp) {
|
|
|
+ if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
+ self.offSetLeft = @((120-38)/2);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirLeft) {
|
|
|
+ self.offSetLeft = @(0);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirRight) {
|
|
|
+ self.offSetLeft = @(120-38);
|
|
|
+ }
|
|
|
+ } else if (dir == PanoramaOrientationViewLeft || dir == PanoramaOrientationViewRight) {
|
|
|
+ if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
+ self.offSetTop = @((120-38)/2);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirUp) {
|
|
|
+ self.offSetTop = @(0);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirDown) {
|
|
|
+ self.offSetTop = @(120-38);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- }
|
|
|
-// else if (dir == PanoramaOrientationViewUp) {
|
|
|
-// if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
-// self.offSetTop = @((120-38)/2);
|
|
|
-//
|
|
|
-//// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-//// make.top.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-////// make.centerX.mas_equalTo(self);
|
|
|
-//// make.top.mas_offset(self.offSetTop.doubleValue);
|
|
|
-//// }];
|
|
|
-// } else if (arrowDir == PanoramaArrowDirLeft) {
|
|
|
-// self.offSetTop = @((120-38)/2);
|
|
|
-//
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.top.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-// make.left.mas_equalTo(self).mas_offset(10);
|
|
|
-// }];
|
|
|
-// } else if (arrowDir == PanoramaArrowDirRight) {
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.top.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-// make.right.mas_equalTo(self).mas_offset(-10);
|
|
|
-// }];
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
- else if (dir == PanoramaOrientationViewLeft || dir == PanoramaOrientationViewRight) {
|
|
|
- if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
- self.offSetTop = @((120-38)/2);
|
|
|
-//
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.left.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.centerY.mas_equalTo(self);
|
|
|
-// make.top.mas_offset(self.offSetTop.doubleValue);
|
|
|
-//
|
|
|
-// }];
|
|
|
- } else if (arrowDir == PanoramaArrowDirUp) {
|
|
|
- self.offSetTop = @(0);
|
|
|
-
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.left.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.top.mas_equalTo(self).mas_offset(10);
|
|
|
-// make.top.mas_offset(self.offSetTop.doubleValue);
|
|
|
-//
|
|
|
-// }];
|
|
|
- } else if (arrowDir == PanoramaArrowDirDown) {
|
|
|
- self.offSetTop = @(120-38);
|
|
|
-
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.left.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-//// make.bottom.mas_equalTo(self).mas_offset(-10);
|
|
|
-// make.top.mas_offset(self.offSetTop.doubleValue);
|
|
|
-//
|
|
|
-// }];
|
|
|
+ } else if (self.dir == TgDirectionLeft || self.dir == TgDirectionRight) {
|
|
|
+ if (dir == PanoramaOrientationViewLeft || dir == PanoramaOrientationViewRight) {
|
|
|
+ if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
+ self.offSetLeft = @((120-38)/2);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirLeft) {
|
|
|
+ self.offSetLeft = @(0);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirRight) {
|
|
|
+ self.offSetLeft = @(120-38);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
+ self.offSetTop = @((120-38)/2);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirUp) {
|
|
|
+ self.offSetTop = @(0);
|
|
|
+ } else if (arrowDir == PanoramaArrowDirDown) {
|
|
|
+ self.offSetTop = @(120-38);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-// else if (dir == PanoramaOrientationViewRight) {
|
|
|
-// if (arrowDir == PanoramaArrowDirCenter) {
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.left.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-// make.centerY.mas_equalTo(self);
|
|
|
-// }];
|
|
|
-// } else if (arrowDir == PanoramaArrowDirUp) {
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.left.offset((PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-// make.top.mas_equalTo(self).mas_offset(10);
|
|
|
-// }];
|
|
|
-// } else if (arrowDir == PanoramaArrowDirDown) {
|
|
|
-// [self.whiteArrow mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
-// make.right.offset(-(PanoramaGuideViewWOrH * imageWidth)/imageHight);
|
|
|
-// make.bottom.mas_equalTo(self).mas_offset(-10);
|
|
|
-// }];
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
+ [self showImageWith:self.showImageView.image];
|
|
|
+
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -523,13 +865,13 @@ CGFloat const PanoramaGuideViewWOrH = 120;
|
|
|
if (_label == nil) {
|
|
|
NSAttributedString *att = [[NSAttributedString alloc]initWithString:@"请沿箭头方向匀速拍摄"];
|
|
|
_label = [[YYLabel alloc]init];
|
|
|
- _label.numberOfLines = 0;
|
|
|
+// _label.numberOfLines = 0;
|
|
|
_label.backgroundColor = [UIColor jk_colorWithHexString:@"000000" andAlpha:0.35];
|
|
|
_label.attributedText = att;
|
|
|
_label.textAlignment = NSTextAlignmentCenter;
|
|
|
_label.layer.cornerRadius = 3;
|
|
|
_label.layer.masksToBounds = YES;
|
|
|
- _label.textVerticalAlignment = YYTextVerticalAlignmentCenter; // 文字置顶显示
|
|
|
+// _label.textVerticalAlignment = YYTextVerticalAlignmentCenter; // 文字置顶显示
|
|
|
_label.textColor = UIColor.whiteColor;
|
|
|
}
|
|
|
return _label;
|