|
@@ -28,6 +28,7 @@
|
|
|
|
|
|
- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
if (self = [super initWithFrame:frame]) {
|
|
|
+ self.contentView.backgroundColor = [UIColor clearColor];
|
|
|
[self.contentView addSubview:self.imageView];
|
|
|
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.edges.mas_offset(0);
|
|
@@ -134,7 +135,9 @@
|
|
|
@end
|
|
|
|
|
|
@implementation PCSPreviewViewController
|
|
|
-
|
|
|
+- (void)dealloc {
|
|
|
+
|
|
|
+}
|
|
|
- (void)viewDidLoad {
|
|
|
[super viewDidLoad];
|
|
|
self.allPlayer = [NSMutableArray array];
|
|
@@ -195,6 +198,7 @@
|
|
|
self.collectionView.delegate = self;
|
|
|
self.collectionView.dataSource = self;
|
|
|
self.collectionView.pagingEnabled = YES;
|
|
|
+ self.collectionView.backgroundColor = [UIColor clearColor];
|
|
|
self.collectionView.hidden = YES;
|
|
|
// 注册item类型
|
|
|
[self.collectionView registerClass:[PCSPreCollectionCell class] forCellWithReuseIdentifier:@"PCSPreCollectionCell"];
|
|
@@ -208,6 +212,7 @@
|
|
|
|
|
|
|
|
|
self.currentIndexPath = nil;
|
|
|
+
|
|
|
if (self.model.continousArray.count > 0 && self.selectIndex == SDK_CAPTURE_MODE_CONTINUOUS) {
|
|
|
self.currentIndex = 1;
|
|
|
self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.continousArray.count - 1 inSection:0];
|
|
@@ -225,6 +230,21 @@
|
|
|
self.currentIndex = 4;
|
|
|
self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.aiPanoramArray.count - 1 inSection:3];
|
|
|
}
|
|
|
+ if(!self.currentIndexPath) {
|
|
|
+ if (self.model.aiPanoramArray.count > 0) {
|
|
|
+ self.currentIndex = 4;
|
|
|
+ self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.aiPanoramArray.count - 1 inSection:3];
|
|
|
+ } else if (self.model.panoramArray.count > 0) {
|
|
|
+ self.currentIndex = 3;
|
|
|
+ self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.panoramArray.count - 1 inSection:2];
|
|
|
+ } else if (self.model.movieArray.count > 0) {
|
|
|
+ self.currentIndex = 2;
|
|
|
+ self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.movieArray.count - 1 inSection:1];
|
|
|
+ } else {
|
|
|
+ self.currentIndex = 1;
|
|
|
+ self.currentIndexPath = [NSIndexPath indexPathForItem:self.model.continousArray.count - 1 inSection:0];
|
|
|
+ }
|
|
|
+ }
|
|
|
[self changeLabelStatusWith:self.currentIndex];
|
|
|
[self updateCountLabelWith:self.currentIndexPath];
|
|
|
|
|
@@ -605,27 +625,50 @@
|
|
|
|
|
|
[alertController dismissViewControllerAnimated:YES completion:nil];
|
|
|
} rightButtonCallBack:^(QuitMultipleModeAlertViewController * _Nonnull alertController) {
|
|
|
+ NSIndexPath *showIndexPath = nil;
|
|
|
if (self.currentIndex == 1) {
|
|
|
if (self.model.continousArray.count > self.currentIndexPath.item) {
|
|
|
[self.model.continousArray removeObjectAtIndex:self.currentIndexPath.item];
|
|
|
}
|
|
|
+ if (self.model.continousArray.count > 0 ) {
|
|
|
+ showIndexPath = [NSIndexPath indexPathForRow:self.currentIndexPath.item - 1 inSection:self.currentIndexPath.section];
|
|
|
+ }
|
|
|
} else if (self.currentIndex == 2) {
|
|
|
if (self.model.movieArray.count > self.currentIndexPath.item) {
|
|
|
[self.model.movieArray removeObjectAtIndex:self.currentIndexPath.item];
|
|
|
}
|
|
|
+ if (self.model.movieArray.count > 0 ) {
|
|
|
+ showIndexPath = [NSIndexPath indexPathForRow:self.currentIndexPath.item - 1 inSection:self.currentIndexPath.section];
|
|
|
+ }
|
|
|
} else if (self.currentIndex == 3) {
|
|
|
if (self.model.panoramArray.count > self.currentIndexPath.item) {
|
|
|
[self.model.panoramArray removeObjectAtIndex:self.currentIndexPath.item];
|
|
|
}
|
|
|
+ if (self.model.panoramArray.count > 0 ) {
|
|
|
+ showIndexPath = [NSIndexPath indexPathForRow:self.currentIndexPath.item - 1 inSection:self.currentIndexPath.section];
|
|
|
+ }
|
|
|
} else if (self.currentIndex == 4) {
|
|
|
if (self.model.aiPanoramArray.count > self.currentIndexPath.item) {
|
|
|
[self.model.aiPanoramArray removeObjectAtIndex:self.currentIndexPath.item];
|
|
|
}
|
|
|
+ if (self.model.aiPanoramArray.count > 0 ) {
|
|
|
+ showIndexPath = [NSIndexPath indexPathForRow:self.currentIndexPath.item - 1 inSection:self.currentIndexPath.section];
|
|
|
+ }
|
|
|
}
|
|
|
- [self setupModeView];
|
|
|
- [self scrollViewDidEndDecelerating:self.collectionView];
|
|
|
|
|
|
- [self.collectionView reloadData];
|
|
|
+
|
|
|
+ if(showIndexPath) {
|
|
|
+ UICollectionViewLayoutAttributes*attributes = [self.collectionView layoutAttributesForItemAtIndexPath:showIndexPath];
|
|
|
+ CGRect rect = attributes.frame;
|
|
|
+ [self.collectionView reloadData];
|
|
|
+ [self.collectionView setContentOffset:CGPointMake(rect.origin.x, rect.origin.y ) animated:NO];
|
|
|
+ } else {
|
|
|
+ [self setupModeView];
|
|
|
+ [self scrollViewDidEndDecelerating:self.collectionView];
|
|
|
+ [self.collectionView reloadData];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
[self.view setNeedsLayout];
|
|
|
[self.view layoutIfNeeded];
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.35 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|