Browse Source

封面选择 _ uifixed

Chris 5 years ago
parent
commit
ab32a424c9

+ 13 - 11
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCoverPick/Controller/AliyunCoverPickViewController.m

@@ -31,13 +31,18 @@
     });
     });
 }
 }
 
 
+- (BOOL)prefersStatusBarHidden
+{
+    return YES;
+}
+
 - (void)setupSubviews {
 - (void)setupSubviews {
-    CGFloat pickWith = ScreenWidth - 56;
+    CGFloat pickWith = ScreenWidth - 28;
     CGFloat factor = _outputSize.height / _outputSize.width;
     CGFloat factor = _outputSize.height / _outputSize.width;
     CGFloat width = ScreenWidth;
     CGFloat width = ScreenWidth;
     CGFloat heigt = ScreenWidth * factor;
     CGFloat heigt = ScreenWidth * factor;
     CGFloat maxheight =
     CGFloat maxheight =
-      ScreenHeight - StatusBarHeight - 69 - SafeBottom - pickWith / 8 - 30;
+      ScreenHeight - StatusBarHeight - 69 - SafeBottom - pickWith / 12 - 30;
 
 
     if (heigt > maxheight) {
     if (heigt > maxheight) {
         heigt = maxheight;
         heigt = maxheight;
@@ -45,11 +50,8 @@
     }
     }
     CGFloat offset = (maxheight - heigt) / 2;
     CGFloat offset = (maxheight - heigt) / 2;
 
 
-    self.coverView = [[UIImageView alloc]
-      initWithFrame:CGRectMake((ScreenWidth - width) / 2,
-                               StatusBarHeight + 44 + offset, width, heigt)];
-    self.coverView = [[UIImageView alloc]
-                      initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
+    self.coverView = [[UIImageView alloc] initWithFrame:CGRectMake((ScreenWidth - width) / 2, StatusBarHeight + 44 + offset, width, heigt)];
+    self.coverView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
     [self.view addSubview:self.coverView];
     [self.view addSubview:self.coverView];
     
     
     self.topView = [[AliyunPublishTopView alloc]
     self.topView = [[AliyunPublishTopView alloc]
@@ -61,15 +63,15 @@
     [self.view addSubview:self.topView];
     [self.view addSubview:self.topView];
     
     
     self.pickView = [[AliyunCoverPickView alloc]
     self.pickView = [[AliyunCoverPickView alloc]
-      initWithFrame:CGRectMake(28,
-                               ScreenHeight - SafeBottom - pickWith / 8 - 30,
-                               pickWith, pickWith / 8)];
+      initWithFrame:CGRectMake(14,
+                               ScreenHeight - SafeBottom - 89,
+                               pickWith, 69)];
     self.pickView.delegate = self;
     self.pickView.delegate = self;
     self.pickView.videoPath = _videoPath;
     self.pickView.videoPath = _videoPath;
     self.pickView.outputSize = _outputSize;
     self.pickView.outputSize = _outputSize;
     [self.view addSubview:self.pickView];
     [self.view addSubview:self.pickView];
     
     
-    self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake((ScreenWidth-100)/2, ScreenHeight - SafeBottom - pickWith / 8 - 30 - 20 - 20, 100, 20)];
+    self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake((ScreenWidth-100)/2, ScreenHeight - SafeBottom - 110, 100, 20)];
     self.tipLabel.text = @"滑动选择封面";
     self.tipLabel.text = @"滑动选择封面";
     self.tipLabel.textColor = [UIColor whiteColor];
     self.tipLabel.textColor = [UIColor whiteColor];
     self.tipLabel.textAlignment = NSTextAlignmentCenter;
     self.tipLabel.textAlignment = NSTextAlignmentCenter;

+ 26 - 19
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoFile/VideoCoverPick/View/AliyunCoverPickView.m

@@ -10,9 +10,13 @@
 #import "AVAsset+VideoInfo.h"
 #import "AVAsset+VideoInfo.h"
 #import "AVC_ShortVideo_Config.h"
 #import "AVC_ShortVideo_Config.h"
 #import <AVFoundation/AVFoundation.h>
 #import <AVFoundation/AVFoundation.h>
+#import "AlivcMacro.h"
+
+#define kCutSegment 12
+
 @interface AliyunCoverPickView ()
 @interface AliyunCoverPickView ()
 @property(nonatomic, strong) UICollectionView *collectionView;
 @property(nonatomic, strong) UICollectionView *collectionView;
-@property(nonatomic, strong) UIImageView *progressView;
+@property(nonatomic, strong) UIView *progressView;
 @property(nonatomic, strong) NSMutableArray *imagesArray;
 @property(nonatomic, strong) NSMutableArray *imagesArray;
 @property(nonatomic, strong) AVAssetImageGenerator *imageGenerator;
 @property(nonatomic, strong) AVAssetImageGenerator *imageGenerator;
 @property(nonatomic, strong) AVAssetImageGenerator *pickGenerator;
 @property(nonatomic, strong) AVAssetImageGenerator *pickGenerator;
@@ -25,35 +29,38 @@
 - (instancetype)initWithFrame:(CGRect)frame {
 - (instancetype)initWithFrame:(CGRect)frame {
   self = [super initWithFrame:frame];
   self = [super initWithFrame:frame];
   if (self) {
   if (self) {
-    _imagesArray = [NSMutableArray arrayWithCapacity:8];
+    _imagesArray = [NSMutableArray arrayWithCapacity:kCutSegment];
     [self setupSubviews];
     [self setupSubviews];
   }
   }
   return self;
   return self;
 }
 }
 
 
 - (void)setupSubviews {
 - (void)setupSubviews {
-  UICollectionViewFlowLayout *followLayout =
+    UICollectionViewFlowLayout *followLayout =
       [[UICollectionViewFlowLayout alloc] init];
       [[UICollectionViewFlowLayout alloc] init];
-  followLayout.itemSize =
-      CGSizeMake(CGRectGetHeight(self.frame), CGRectGetHeight(self.frame));
-  followLayout.minimumLineSpacing = 0;
-  followLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
+    followLayout.itemSize = CGSizeMake((ScreenWidth-28)/kCutSegment, 69);
+    followLayout.minimumLineSpacing = 0;
+    followLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
 
 
-  _collectionView = [[UICollectionView alloc]
+    _collectionView = [[UICollectionView alloc]
              initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame),
              initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.frame),
                                       CGRectGetHeight(self.frame))
                                       CGRectGetHeight(self.frame))
       collectionViewLayout:followLayout];
       collectionViewLayout:followLayout];
-  _collectionView.dataSource = (id<UICollectionViewDataSource>)self;
-  [_collectionView registerClass:[UICollectionViewCell class]
+    _collectionView.dataSource = (id<UICollectionViewDataSource>)self;
+    [_collectionView registerClass:[UICollectionViewCell class]
       forCellWithReuseIdentifier:@"cell"];
       forCellWithReuseIdentifier:@"cell"];
-  [self addSubview:_collectionView];
-  UIView *view = [[UIView alloc] initWithFrame:self.bounds];
-  view.backgroundColor = [UIColor clearColor];
-  [self addSubview:view];
-  _progressView = [[UIImageView alloc]
-      initWithImage:[AliyunImage imageNamed:@"icon_cover_slide"]];
-  _progressView.frame = CGRectMake(0, 0, 4, CGRectGetHeight(self.frame));
-  [view addSubview:_progressView];
+    [self addSubview:_collectionView];
+    UIView *view = [[UIView alloc] initWithFrame:self.bounds];
+    view.backgroundColor = [UIColor clearColor];
+    [self addSubview:view];
+    
+    _progressView = [[UIView alloc] init];
+    _progressView.frame = CGRectMake(0, 0, (ScreenWidth-28)/kCutSegment, CGRectGetHeight(self.frame));
+    _progressView.layer.borderWidth = 2;
+    _progressView.layer.borderColor = [UIColor whiteColor].CGColor;
+    _progressView.layer.cornerRadius = 4;
+    _progressView.layer.masksToBounds = YES;
+    [view addSubview:_progressView];
 }
 }
 
 
 - (void)parseAsset {
 - (void)parseAsset {
@@ -70,7 +77,7 @@
 
 
   CMTime startTime = kCMTimeZero;
   CMTime startTime = kCMTimeZero;
   NSMutableArray *array = [NSMutableArray array];
   NSMutableArray *array = [NSMutableArray array];
-  CMTime addTime = CMTimeMake(_duration * 1000 / 8.0f, 1000);
+  CMTime addTime = CMTimeMake(_duration * 1000 / kCutSegment, 1000);
 
 
   CMTime endTime = CMTimeMake(_duration * 1000, 1000);
   CMTime endTime = CMTimeMake(_duration * 1000, 1000);
   while (CMTIME_COMPARE_INLINE(startTime, <, endTime)) {
   while (CMTIME_COMPARE_INLINE(startTime, <, endTime)) {

BIN
RainbowPlanet/RainbowPlanet/Modules/PublishModule/AliyunVideo/AlivcShortVideo/ShortVideoResource/QPSDK.bundle/icon_cover_slide.png