imageDetailsScrollViewController.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. //
  2. // imageDetailsScrollViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/5/16.
  6. //
  7. #import "imageDetailsScrollViewController.h"
  8. #import <SDCycleScrollView/SDCycleScrollView.h>
  9. #import "editTypeBottomView.h"
  10. #import "editShareView.h"
  11. #import "NASFilePicModel.h"
  12. #import "uploadFileRecordViewController.h"
  13. #import "previewLandscapeTopView.h"
  14. #import "previewLandscapeTopMoreView.h"
  15. #import "UIInterface+HXRotation.h"
  16. @interface imageDetailsScrollViewController ()
  17. {
  18. NSMutableArray *imageURLStringsGroup;
  19. }
  20. @property (nonatomic,strong) SDCycleScrollView *curScrollView;
  21. @property(nonatomic,strong) editTypeBottomView*curEditTypeBottomView;
  22. @property(nonatomic,assign) BOOL isPortraitType;//竖屏状态
  23. @property(nonatomic,strong) previewLandscapeTopView*previewLandscapeTopV;
  24. @property(nonatomic,strong) previewLandscapeTopMoreView*previewLandscapeTopMoreV;
  25. @property(nonatomic,strong) editShareView *editShareV;
  26. @property(nonatomic,assign) BOOL isHideMsgType;//隐藏上下信息
  27. @end
  28. @implementation imageDetailsScrollViewController
  29. - (void)viewDidLoad {
  30. [super viewDidLoad];
  31. // Do any additional setup after loading the view.
  32. [self.toolBar setHidden:YES];
  33. [self.navigationBar setHidden:YES];
  34. [self.navBarBGView setHidden:NO];
  35. self.navBarBGView.backgroundColor = [UIColor clearColor];
  36. self.titleLabel.textColor = [UIColor whiteColor];
  37. [self.backBtn setImage:[UIImage imageNamed:@"icon_white_back"] forState:UIControlStateNormal];
  38. [self.view setBackgroundColor:[UIColor blackColor]];
  39. [self drawAnyView];
  40. _isPortraitType = YES;
  41. //数据埋点
  42. [[netWorkManager shareInstance] DataEmbeddingPointBy:4 withEventValue:@"Image_preview"];
  43. }
  44. - (void)drawAnyView
  45. {
  46. // gradient
  47. CAGradientLayer *gl = [CAGradientLayer layer];
  48. gl.frame = CGRectMake(0,0,SCREEN_W,60 + AdaptTabHeight);
  49. gl.startPoint = CGPointMake(0.5, 0);
  50. gl.endPoint = CGPointMake(0.5, 1);
  51. gl.colors = @[(__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0].CGColor, (__bridge id)[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.0].CGColor];
  52. gl.locations = @[@(0), @(1.0f)];
  53. //[self.layer addSublayer:gl];
  54. [self.navBarBGView.layer insertSublayer:gl atIndex:0];
  55. //横屏的头部
  56. _previewLandscapeTopV = [[previewLandscapeTopView alloc] init];
  57. [self.view addSubview:_previewLandscapeTopV];
  58. _previewLandscapeTopV.hidden = YES;
  59. [_previewLandscapeTopV mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.mas_equalTo(0);
  61. make.right.mas_equalTo(0);
  62. make.top.mas_equalTo(0);
  63. make.height.mas_equalTo(60);
  64. }];
  65. KWeakSelf
  66. _previewLandscapeTopV.didClickButton = ^(NSInteger tag) {
  67. [weakSelf didClickButInLandscapeTopFunBy:tag];
  68. };
  69. }
  70. - (void)viewDidAppear:(BOOL)animated
  71. {
  72. [super viewDidAppear:animated];
  73. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
  74. ksharedAppDelegate.supportScreenRotateType = YES;
  75. //开始生成 设备旋转 通知
  76. [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
  77. //添加 设备旋转 通知
  78. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
  79. }
  80. - (void)viewWillDisappear:(BOOL)animated {
  81. [super viewWillDisappear:animated];
  82. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDarkContent];
  83. ksharedAppDelegate.supportScreenRotateType = NO;
  84. //销毁 设备旋转 通知
  85. [[NSNotificationCenter defaultCenter] removeObserver:self
  86. name:UIDeviceOrientationDidChangeNotification
  87. object:nil];
  88. //结束 设备旋转通知
  89. [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
  90. //切换到竖屏
  91. [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
  92. }
  93. - (BOOL)shouldAutorotate {
  94. return YES;
  95. }
  96. /// 如果不好用则copy VC中 加一下
  97. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  98. return UIInterfaceOrientationMaskAllButUpsideDown;
  99. }
  100. /**屏幕旋转的通知回调*/
  101. - (void)orientChange:(NSNotification *)noti {
  102. UIDeviceOrientation orient = [UIDevice currentDevice].orientation;
  103. switch (orient) {
  104. case UIDeviceOrientationPortrait:
  105. NSLog(@"竖直屏幕");
  106. if(!_isPortraitType){
  107. [self screenLandscapeToPortraitFun];
  108. }
  109. break;
  110. case UIDeviceOrientationLandscapeLeft:
  111. NSLog(@"手机左转");
  112. if(_isPortraitType){
  113. [self screenPortraitToLandscapeFun];
  114. }
  115. break;
  116. case UIDeviceOrientationPortraitUpsideDown:
  117. // NSLog(@"手机竖直");
  118. break;
  119. case UIDeviceOrientationLandscapeRight:
  120. NSLog(@"手机右转");
  121. if(_isPortraitType){
  122. [self screenPortraitToLandscapeFun];
  123. }
  124. break;
  125. case UIDeviceOrientationUnknown:
  126. //NSLog(@"未知");
  127. break;
  128. case UIDeviceOrientationFaceUp:
  129. //NSLog(@"手机屏幕朝上");
  130. break;
  131. case UIDeviceOrientationFaceDown:
  132. //NSLog(@"手机屏幕朝下");
  133. break;
  134. default:
  135. break;
  136. }
  137. }
  138. #pragma mark 竖屏转横屏
  139. - (void)screenPortraitToLandscapeFun{
  140. _isPortraitType = NO;
  141. _curEditTypeBottomView.hidden = YES;
  142. self.navBarBGView.hidden = YES;
  143. _previewLandscapeTopV.hidden = NO;
  144. [self didClickScreenFun:NO];
  145. [_previewLandscapeTopV mas_remakeConstraints:^(MASConstraintMaker *make) {
  146. make.left.mas_equalTo(0);
  147. make.right.mas_equalTo(0);
  148. make.top.mas_equalTo(0);
  149. make.height.mas_equalTo(60);
  150. }];
  151. if(_editShareV){
  152. _editShareV.isPortraitType = _isPortraitType;
  153. }
  154. if(_editShareV.secretShareView)
  155. {
  156. _editShareV.secretShareView.isPortraitType = _isPortraitType;
  157. }
  158. [_curScrollView.mainView mas_remakeConstraints:^(MASConstraintMaker *make) {
  159. make.left.mas_equalTo(0.0);
  160. make.right.mas_equalTo(0.0);
  161. make.top.mas_equalTo(0.0);
  162. make.bottom.mas_equalTo(0.0);
  163. }];
  164. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  165. [self->_curScrollView adjustWhenControllerViewWillAppera];
  166. });
  167. }
  168. #pragma mark 横屏转竖屏
  169. - (void)screenLandscapeToPortraitFun{
  170. _isPortraitType = YES;
  171. _curEditTypeBottomView.hidden = NO;
  172. self.navBarBGView.hidden = NO;
  173. _previewLandscapeTopV.hidden = YES;
  174. [self didClickScreenFun:NO];
  175. if(_editShareV){
  176. _editShareV.isPortraitType = _isPortraitType;
  177. }
  178. if(_editShareV.secretShareView)
  179. {
  180. _editShareV.secretShareView.isPortraitType = _isPortraitType;
  181. }
  182. [_curScrollView.mainView mas_remakeConstraints:^(MASConstraintMaker *make) {
  183. make.left.mas_equalTo(0.0);
  184. make.right.mas_equalTo(0.0);
  185. make.top.mas_equalTo(0.0);
  186. make.bottom.mas_equalTo(0.0);
  187. }];
  188. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  189. [self->_curScrollView adjustWhenControllerViewWillAppera];
  190. });
  191. }
  192. #pragma mark 用户点击分享
  193. - (void)gotoShareViewFun
  194. {
  195. _editShareV = [[editShareView alloc] init];
  196. NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
  197. _editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[dataModel]];
  198. _editShareV.shareFileType = @"2";
  199. [self.view addSubview:_editShareV];
  200. _editShareV.isPortraitType = _isPortraitType;
  201. [_editShareV mas_makeConstraints:^(MASConstraintMaker *make) {
  202. make.left.mas_equalTo(0);
  203. make.right.mas_equalTo(0);
  204. make.bottom.mas_equalTo(0);
  205. make.top.mas_equalTo(0);
  206. }];
  207. KWeakSelf
  208. _editShareV.didClickCloseFun = ^{
  209. [weakSelf clearShareAboutViewFun];
  210. };
  211. }
  212. #pragma mark 清理分享相关页面
  213. - (void)clearShareAboutViewFun
  214. {
  215. if(_editShareV.secretShareView){
  216. _editShareV.secretShareView = nil;
  217. }
  218. _editShareV = nil;
  219. }
  220. - (void)setTotalDataArr:(NSMutableArray *)totalDataArr
  221. {
  222. _totalDataArr = totalDataArr;
  223. imageURLStringsGroup = [NSMutableArray new];
  224. for (NASFilePicDataArrModel*dataModel in _totalDataArr) {
  225. NSString * URLString = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",ksharedAppDelegate.NASFileByBoxService,dataModel.path];
  226. URLString = [URLString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  227. [imageURLStringsGroup addObject:URLString];
  228. }
  229. //HLog(@"URLString:\n%@",imageURLStringsGroup);
  230. _curScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageURLStringsGroup:imageURLStringsGroup];
  231. _curScrollView.autoScroll = NO;
  232. _curScrollView.infiniteLoop = NO;
  233. _curScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
  234. //_curScrollView.placeholderImage = [UIImage imageNamed:@"uploadFile_image"];
  235. //[self.view addSubview:_curScrollView];
  236. [self.view insertSubview:_curScrollView belowSubview:self.navBarBGView];
  237. _curScrollView.backgroundColor = [UIColor blackColor];
  238. [_curScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
  239. make.left.mas_equalTo(0);
  240. make.right.mas_equalTo(0);
  241. //make.top.equalTo(self.navBarBGView.mas_bottom).offset(0);
  242. make.top.mas_equalTo(0);
  243. //make.bottom.mas_equalTo(-(60+ AdaptTabHeight));
  244. make.bottom.mas_equalTo(0);
  245. }];
  246. KWeakSelf
  247. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  248. [self->_curScrollView makeScrollViewScrollToIndex:self->_index];
  249. [weakSelf setTitleLabelTextFunBy:self->_index];
  250. [weakSelf cycleScrollViewDidScrollToIndex:self->_index];
  251. self->_curScrollView.hidden = NO;
  252. });
  253. _curScrollView.itemDidScrollOperationBlock = ^(NSInteger currentIndex) {
  254. weakSelf.index = currentIndex;
  255. [weakSelf setTitleLabelTextFunBy:currentIndex];
  256. [weakSelf cycleScrollViewDidScrollToIndex:currentIndex];
  257. };
  258. _curScrollView.clickItemOperationBlock = ^(NSInteger currentIndex) {
  259. self->_isHideMsgType = !self->_isHideMsgType;
  260. [weakSelf didClickScreenFun:self->_isHideMsgType];
  261. };
  262. _curEditTypeBottomView = [[editTypeBottomView alloc] init];
  263. _curEditTypeBottomView.isBlackType = YES;
  264. [self.view addSubview:_curEditTypeBottomView];
  265. //_curEditTypeBottomView.hidden = YES;
  266. [_curEditTypeBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
  267. make.left.mas_equalTo(0);
  268. make.right.mas_equalTo(0);
  269. make.bottom.mas_equalTo(0);
  270. make.height.mas_equalTo(60 + AdaptTabHeight);
  271. }];
  272. //KWeakSelf
  273. #pragma mark 编辑状态的 下载 分享 删除 响应事件
  274. _curEditTypeBottomView.didClickButtonFun = ^(NSInteger tag) {
  275. if(tag==1){
  276. //[[iToast makeText:@"点击下载"] show];
  277. [weakSelf gotoDownLoadFileFun];
  278. }
  279. else if(tag==2){
  280. [weakSelf gotoShareViewFun];
  281. }
  282. else if(tag==3){
  283. //[[iToast makeText:@"点击删除"] show];
  284. [weakSelf showDeleteAlearViewFun];
  285. }
  286. };
  287. }
  288. - (void)setTitleLabelTextFunBy:(NSInteger)index
  289. {
  290. if(index >=0 && index < _totalDataArr.count){
  291. NASFilePicDataArrModel *dataModel = _totalDataArr[index];
  292. self.titleLabel.text = dataModel.name;
  293. _previewLandscapeTopV.titleLabel.text = dataModel.name;
  294. }
  295. }
  296. #pragma mark 删除图片
  297. - (void)showDeleteAlearViewFun
  298. {
  299. NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil);
  300. NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil);
  301. KWeakSelf
  302. ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr
  303. msg:tipStr
  304. imageStr:nil
  305. cancelTitle:NSLocalizedString(@"other_cancel",nil)
  306. okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES
  307. didClickOk:^{
  308. [weakSelf delFileListFun];
  309. } didClickCancel:^{
  310. }];
  311. curAlretVC.modalPresentationStyle = UIModalPresentationCustom;
  312. [self presentViewController:curAlretVC animated:YES completion:^{
  313. curAlretVC.view.superview.backgroundColor = [UIColor clearColor];
  314. }];
  315. }
  316. #pragma mark 删除文件数据
  317. - (void)delFileListFun
  318. {
  319. NSMutableDictionary*paraDict = [NSMutableDictionary new];
  320. if(_index >=0 && _index < _totalDataArr.count){
  321. NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
  322. NSArray *pathArr = @[dataModel.path];
  323. //NSArray *pathArr = @[dataModel.path,dataModel.path];
  324. [paraDict setValue:pathArr forKey:@"path"];
  325. }
  326. [self showNewIndicatorWithCanBack:YES canTouch:NO];
  327. //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC]
  328. KWeakSelf //@"delFile"
  329. [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) {
  330. [weakSelf removeNewIndicator];
  331. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  332. if(model && model.status == 0){
  333. [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show];
  334. if(weakSelf.didNeedToRegetDataFun){
  335. weakSelf.didNeedToRegetDataFun();
  336. }
  337. [weakSelf didDeleteSucFun];
  338. [weakSelf.navigationController popViewControllerAnimated:YES];
  339. }
  340. else{
  341. }
  342. } failure:^(NSError * _Nonnull error) {
  343. [weakSelf removeNewIndicator];
  344. }];
  345. //数据埋点
  346. [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Image_delete"];
  347. }
  348. #pragma mark 删除成功
  349. - (void)didDeleteSucFun
  350. {
  351. //删除最近文件
  352. if(_index >=0 && _index < _totalDataArr.count){
  353. NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
  354. [[lastFileManager shareManager] deleteFileInfoWithUrl:dataModel.path];
  355. }
  356. [_totalDataArr removeAllObjects];
  357. }
  358. - (void)gotoDownLoadFileFun
  359. {
  360. if(_index >=0 && _index < _totalDataArr.count){
  361. NASFilePicDataArrModel *dataModel = _totalDataArr[_index];
  362. couldPhoneFileModel* fileModel = [couldPhoneFileModel new];
  363. fileModel.fileType = dataModel.type;
  364. fileModel.path = dataModel.path;
  365. fileModel.name = dataModel.name;
  366. fileModel.length = dataModel.size;
  367. NSMutableArray *arr = [NSMutableArray new];
  368. [arr addObject:fileModel];
  369. //切换到竖屏
  370. [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
  371. uploadFileRecordViewController *vc = [uploadFileRecordViewController new];
  372. [self.navigationController pushViewController:vc animated:YES];
  373. vc.isDownloadingType = YES;
  374. [vc gotoDownloadFile:arr];
  375. }
  376. }
  377. - (void)setCanShareType:(BOOL)canShareType
  378. {
  379. _canShareType = canShareType;
  380. [_curEditTypeBottomView setCanShaewFunBy:canShareType];
  381. }
  382. #pragma mark 图片滑动
  383. - (void)cycleScrollViewDidScrollToIndex:(NSInteger)index{
  384. if(index >=0 && index < _totalDataArr.count){
  385. NASFilePicDataArrModel *dataModel = _totalDataArr[index];
  386. lastFileModel *lastFileMod = [lastFileModel new];
  387. lastFileMod.path = dataModel.path;
  388. lastFileMod.name = dataModel.name;
  389. lastFileMod.time = dataModel.time;
  390. lastFileMod.size = dataModel.size;
  391. lastFileMod.duration = dataModel.duration;
  392. lastFileMod.type = @".jpg";
  393. lastFileMod.lastPreTime = [iTools getNowTimeStamp];
  394. [[lastFileManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path];
  395. }
  396. }
  397. #pragma mark 横屏时点击顶部按钮
  398. - (void)didClickButInLandscapeTopFunBy:(NSInteger)tag
  399. {
  400. if(tag == 1){
  401. [self backBtnPressed];
  402. }
  403. else if(tag == 2){
  404. [self showPreviewLandscapeTopMoreViewFun];
  405. }
  406. else if(tag == 3){//分享
  407. [self gotoShareViewFun];
  408. }
  409. }
  410. #pragma mark 删除横屏的 more
  411. - (void)deletePreviewLandscapeTopMoreViewFun
  412. {
  413. [_previewLandscapeTopMoreV removeFromSuperview];
  414. _previewLandscapeTopMoreV = nil;
  415. }
  416. #pragma mark 点开了横屏的 more
  417. - (void)showPreviewLandscapeTopMoreViewFun
  418. {
  419. [self deletePreviewLandscapeTopMoreViewFun];
  420. _previewLandscapeTopMoreV = [[previewLandscapeTopMoreView alloc] init];
  421. [self.view addSubview:_previewLandscapeTopMoreV];
  422. [_previewLandscapeTopMoreV mas_makeConstraints:^(MASConstraintMaker *make) {
  423. make.left.mas_equalTo(0);
  424. make.right.mas_equalTo(0);
  425. make.top.mas_equalTo(0);
  426. make.bottom.mas_equalTo(0);
  427. }];
  428. KWeakSelf
  429. _previewLandscapeTopMoreV.didClickButtonFun = ^(NSInteger tag) {
  430. if(tag==10){
  431. //[[iToast makeText:@"点击下载"] show];
  432. //切换到竖屏
  433. [weakSelf hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait];
  434. [weakSelf screenLandscapeToPortraitFun];
  435. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  436. [weakSelf gotoDownLoadFileFun];
  437. });
  438. }
  439. else if(tag==11){
  440. //[[iToast makeText:@"点击删除"] show];
  441. [weakSelf showDeleteAlearViewFun];
  442. }
  443. };
  444. }
  445. #pragma mark 点开了屏幕
  446. - (void)didClickScreenFun:(BOOL)isHideMsgType
  447. {
  448. _isHideMsgType = isHideMsgType;
  449. if(isHideMsgType){//处理隐藏
  450. if(_isPortraitType){
  451. CGRect BottomViewRect = _curEditTypeBottomView.frame;
  452. CGRect fixBottomViewRect = CGRectMake(BottomViewRect.origin.x, BottomViewRect.origin.y + BottomViewRect.size.height, BottomViewRect.size.width, BottomViewRect.size.height);
  453. CGRect navBarBGViewRect = self.navBarBGView.frame;
  454. CGRect fixNavBarBGViewRect = CGRectMake(navBarBGViewRect.origin.x, navBarBGViewRect.origin.y - navBarBGViewRect.size.height, navBarBGViewRect.size.width, navBarBGViewRect.size.height);
  455. [UIView animateWithDuration:0.3 animations:^{
  456. self->_curEditTypeBottomView.frame = fixBottomViewRect;
  457. self.navBarBGView.frame = fixNavBarBGViewRect;
  458. } completion:^(BOOL finished) {
  459. self->_curEditTypeBottomView.hidden = YES;
  460. self.navBarBGView.hidden = YES;
  461. //frame 还原
  462. self->_curEditTypeBottomView.frame = BottomViewRect;
  463. self.navBarBGView.frame = navBarBGViewRect;
  464. }];
  465. }
  466. else{
  467. CGRect TopViewRect = _previewLandscapeTopV.frame;
  468. CGRect fixTopViewRect = CGRectMake(TopViewRect.origin.x, TopViewRect.origin.y - TopViewRect.size.height, TopViewRect.size.width, TopViewRect.size.height);
  469. [UIView animateWithDuration:0.3 animations:^{
  470. self->_previewLandscapeTopV.frame = fixTopViewRect;
  471. } completion:^(BOOL finished) {
  472. self->_previewLandscapeTopV.hidden = YES;
  473. //frame 还原
  474. self->_previewLandscapeTopV.frame = TopViewRect;
  475. }];
  476. }
  477. }
  478. else{//处理显示
  479. if(_isPortraitType){
  480. CGRect BottomViewRect = _curEditTypeBottomView.frame;
  481. CGRect fixBottomViewRect = CGRectMake(BottomViewRect.origin.x, BottomViewRect.origin.y + BottomViewRect.size.height, BottomViewRect.size.width, BottomViewRect.size.height);
  482. CGRect navBarBGViewRect = self.navBarBGView.frame;
  483. CGRect fixNavBarBGViewRect = CGRectMake(navBarBGViewRect.origin.x, navBarBGViewRect.origin.y - navBarBGViewRect.size.height, navBarBGViewRect.size.width, navBarBGViewRect.size.height);
  484. self->_curEditTypeBottomView.frame = fixBottomViewRect;
  485. self.navBarBGView.frame = fixNavBarBGViewRect;
  486. [UIView animateWithDuration:0.3 animations:^{
  487. //frame 还原
  488. self->_curEditTypeBottomView.frame = BottomViewRect;
  489. self.navBarBGView.frame = navBarBGViewRect;
  490. } completion:^(BOOL finished) {
  491. self->_curEditTypeBottomView.hidden = NO;
  492. self.navBarBGView.hidden = NO;
  493. }];
  494. }
  495. else{
  496. _previewLandscapeTopV.hidden = NO;
  497. CGRect topViewRect = _previewLandscapeTopV.frame;
  498. CGRect fixTopViewRect = CGRectMake(topViewRect.origin.x, topViewRect.origin.y - topViewRect.size.height, topViewRect.size.width, topViewRect.size.height);
  499. self->_previewLandscapeTopV.frame = fixTopViewRect;
  500. [UIView animateWithDuration:0.3 animations:^{
  501. //frame 还原
  502. self->_previewLandscapeTopV.frame = topViewRect;
  503. } completion:^(BOOL finished) {
  504. self->_previewLandscapeTopV.hidden = NO;
  505. }];
  506. }
  507. }
  508. }
  509. @end