|
@@ -23,55 +23,55 @@
|
|
|
@implementation AliyunCoverPickViewController
|
|
|
|
|
|
- (void)viewDidLoad {
|
|
|
- [super viewDidLoad];
|
|
|
- [self setupSubviews];
|
|
|
- dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
|
|
|
- ^{
|
|
|
- [self.pickView loadThumbnailData];
|
|
|
- });
|
|
|
+ [super viewDidLoad];
|
|
|
+ [self setupSubviews];
|
|
|
+
|
|
|
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
|
|
|
+ ^{
|
|
|
+ [self.pickView loadThumbnailData];
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- (void)setupSubviews {
|
|
|
- self.topView = [[AliyunPublishTopView alloc]
|
|
|
- initWithFrame:CGRectMake(0, 0, ScreenWidth, StatusBarHeight + 44)];
|
|
|
- self.topView.nameLabel.text = @"编辑封面";
|
|
|
- [self.topView.cancelButton setImage:[AliyunImage imageNamed:@"cancel"]
|
|
|
- forState:UIControlStateNormal];
|
|
|
- [self.topView.cancelButton setTitle:nil forState:UIControlStateNormal];
|
|
|
- [self.topView.finishButton setImage:[AliyunImage imageNamed:@"check"]
|
|
|
- forState:UIControlStateNormal];
|
|
|
- [self.topView.finishButton setTitle:nil forState:UIControlStateNormal];
|
|
|
- self.topView.delegate = self;
|
|
|
- self.topView.delegate = self;
|
|
|
- [self.view addSubview:self.topView];
|
|
|
-
|
|
|
- CGFloat pickWith = ScreenWidth - 56;
|
|
|
- CGFloat factor = _outputSize.height / _outputSize.width;
|
|
|
- CGFloat width = ScreenWidth;
|
|
|
- CGFloat heigt = ScreenWidth * factor;
|
|
|
- CGFloat maxheight =
|
|
|
+ CGFloat pickWith = ScreenWidth - 56;
|
|
|
+ CGFloat factor = _outputSize.height / _outputSize.width;
|
|
|
+ CGFloat width = ScreenWidth;
|
|
|
+ CGFloat heigt = ScreenWidth * factor;
|
|
|
+ CGFloat maxheight =
|
|
|
ScreenHeight - StatusBarHeight - 69 - SafeBottom - pickWith / 8 - 30;
|
|
|
|
|
|
- if (heigt > maxheight) {
|
|
|
- heigt = maxheight;
|
|
|
- width = heigt / factor;
|
|
|
- }
|
|
|
- CGFloat offset = (maxheight - heigt) / 2;
|
|
|
+ if (heigt > maxheight) {
|
|
|
+ heigt = maxheight;
|
|
|
+ width = heigt / factor;
|
|
|
+ }
|
|
|
+ CGFloat offset = (maxheight - heigt) / 2;
|
|
|
|
|
|
- self.coverView = [[UIImageView alloc]
|
|
|
+ self.coverView = [[UIImageView alloc]
|
|
|
initWithFrame:CGRectMake((ScreenWidth - width) / 2,
|
|
|
StatusBarHeight + 44 + offset, width, heigt)];
|
|
|
- [self.view addSubview:self.coverView];
|
|
|
+ self.coverView = [[UIImageView alloc]
|
|
|
+ initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
|
|
|
+ [self.view addSubview:self.coverView];
|
|
|
+
|
|
|
+ self.topView = [[AliyunPublishTopView alloc]
|
|
|
+ initWithFrame:CGRectMake(0, 0, ScreenWidth, StatusBarHeight + 44)];
|
|
|
+ [self.topView.cancelButton setImage:[UIImage imageNamed:@"navbar_back_white"]
|
|
|
+ forState:UIControlStateNormal];
|
|
|
+ [self.topView.cancelButton setTitle:nil forState:UIControlStateNormal];
|
|
|
+ [self.topView.finishButton setTitle:@"下一步" forState:UIControlStateNormal];
|
|
|
+ self.topView.delegate = self;
|
|
|
+ self.topView.delegate = self;
|
|
|
+ [self.view addSubview:self.topView];
|
|
|
|
|
|
- self.pickView = [[AliyunCoverPickView alloc]
|
|
|
+ self.pickView = [[AliyunCoverPickView alloc]
|
|
|
initWithFrame:CGRectMake(28,
|
|
|
ScreenHeight - SafeBottom - pickWith / 8 - 30,
|
|
|
pickWith, pickWith / 8)];
|
|
|
- self.pickView.delegate = self;
|
|
|
- self.pickView.videoPath = _videoPath;
|
|
|
- self.pickView.outputSize = _outputSize;
|
|
|
- [self.view addSubview:self.pickView];
|
|
|
- self.view.backgroundColor = [AliyunIConfig config].backgroundColor;
|
|
|
+ self.pickView.delegate = self;
|
|
|
+ self.pickView.videoPath = _videoPath;
|
|
|
+ self.pickView.outputSize = _outputSize;
|
|
|
+ [self.view addSubview:self.pickView];
|
|
|
+ self.view.backgroundColor = [AliyunIConfig config].backgroundColor;
|
|
|
}
|
|
|
|
|
|
#pragma mark - top view delegate
|
|
@@ -81,8 +81,11 @@
|
|
|
}
|
|
|
|
|
|
- (void)finishButtonClicked {
|
|
|
- _finishHandler(_coverView.image);
|
|
|
- [self.navigationController popViewControllerAnimated:YES];
|
|
|
+ // FIXME: 完成封面选择,去发布
|
|
|
+ NSLog(@"完成封面选择,去发布");
|
|
|
+
|
|
|
+// _finishHandler(_coverView.image);
|
|
|
+// [self.navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
|
|
|
#pragma mark - pick view delegate
|