优化释放视图进而优化内存
This commit is contained in:
parent
606dc13535
commit
4ff548f2f6
@ -58,6 +58,8 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
return view
|
return view
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
//标记是否应该将vr预览的那个视图弹出来
|
||||||
|
var shouldShowAlbumFilterPopView = false
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
self.navigationController?.tabBarController!.tabBar.isHidden = true;
|
self.navigationController?.tabBarController!.tabBar.isHidden = true;
|
||||||
@ -65,6 +67,11 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
|
|
||||||
self.setNavgationBarColor(color: UIColor.clear)
|
self.setNavgationBarColor(color: UIColor.clear)
|
||||||
self.checkAirPlayStatus()
|
self.checkAirPlayStatus()
|
||||||
|
|
||||||
|
if shouldShowAlbumFilterPopView {
|
||||||
|
showAlbumFilterPopView()
|
||||||
|
shouldShowAlbumFilterPopView = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -350,7 +357,13 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
|
|
||||||
}else if sender.tag == 22 {
|
}else if sender.tag == 22 {
|
||||||
//VR预览
|
//VR预览
|
||||||
|
showAlbumFilterPopView()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//显示vr预览的弹窗
|
||||||
|
func showAlbumFilterPopView() {
|
||||||
let view = CCSpaceAlbumFilterPopView2.init(frame: CGRectMake(0, 0, KScreenWidth, KScreenHeight))
|
let view = CCSpaceAlbumFilterPopView2.init(frame: CGRectMake(0, 0, KScreenWidth, KScreenHeight))
|
||||||
self.view.addSubview(view)
|
self.view.addSubview(view)
|
||||||
view.show()
|
view.show()
|
||||||
@ -358,7 +371,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
//选择图片
|
//选择图片
|
||||||
view.selectedImageHandler = { [weak self] data,asset in
|
view.selectedImageHandler = { [weak self] data,asset in
|
||||||
print("回调")
|
print("回调")
|
||||||
|
self?.shouldShowAlbumFilterPopView = true
|
||||||
let vc = CCSpatialPhotoDisplayController()
|
let vc = CCSpatialPhotoDisplayController()
|
||||||
vc.photoOriginalData = data
|
vc.photoOriginalData = data
|
||||||
vc.imageAsset = asset
|
vc.imageAsset = asset
|
||||||
@ -373,6 +386,7 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
nav.modalTransitionStyle = UIModalTransitionStyle.coverVertical
|
nav.modalTransitionStyle = UIModalTransitionStyle.coverVertical
|
||||||
nav.modalPresentationStyle = .fullScreen
|
nav.modalPresentationStyle = .fullScreen
|
||||||
self?.present(nav, animated: true)
|
self?.present(nav, animated: true)
|
||||||
|
self?.shouldShowAlbumFilterPopView = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -381,16 +395,11 @@ class CCHomeController: BaseController, LLCycleScrollViewDelegate,MFMailComposeV
|
|||||||
vc.sourceVideoURL = url
|
vc.sourceVideoURL = url
|
||||||
vc.videoOriginalPHAsset = asset
|
vc.videoOriginalPHAsset = asset
|
||||||
self?.navigationController?.pushViewController(vc, animated: true)
|
self?.navigationController?.pushViewController(vc, animated: true)
|
||||||
}
|
self?.shouldShowAlbumFilterPopView = true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func addMenu(){
|
func addMenu(){
|
||||||
let vc = MenuVC()
|
let vc = MenuVC()
|
||||||
self.navigationController?.pushViewController(vc, animated: true)
|
self.navigationController?.pushViewController(vc, animated: true)
|
||||||
|
|||||||
@ -210,6 +210,7 @@ class CCSpaceAlbumFilterPopView2: UIView {
|
|||||||
|
|
||||||
//MARK: - 释放销毁
|
//MARK: - 释放销毁
|
||||||
deinit {
|
deinit {
|
||||||
|
print("ccspacealbumfilterpopview2....deinit....")
|
||||||
NotificationCenter.default.removeObserver(self)
|
NotificationCenter.default.removeObserver(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,30 +494,34 @@ extension CCSpaceAlbumFilterPopView2:UICollectionViewDataSource, UICollectionVie
|
|||||||
|
|
||||||
// 关闭
|
// 关闭
|
||||||
if Thread.isMainThread {
|
if Thread.isMainThread {
|
||||||
// self.hide()
|
//
|
||||||
if let imageData = imageData {
|
if let imageData = imageData {
|
||||||
self.selectedImageHandler?(imageData,asset)
|
self.selectedImageHandler?(imageData,asset)
|
||||||
}
|
}
|
||||||
|
self.hide()
|
||||||
}else{
|
}else{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
// self.hide()
|
//
|
||||||
if let imageData = imageData {
|
if let imageData = imageData {
|
||||||
self.selectedImageHandler?(imageData,asset)
|
self.selectedImageHandler?(imageData,asset)
|
||||||
}
|
}
|
||||||
|
self.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if asset.mediaType == .video {
|
}else if asset.mediaType == .video {
|
||||||
//选择的是video
|
//选择的是video
|
||||||
self.getVideoURL(from: asset) { url,avasset in
|
self.getVideoURL(from: asset) {[weak self] url,avasset in
|
||||||
|
|
||||||
if Thread.isMainThread {
|
if Thread.isMainThread {
|
||||||
// self.hide()
|
//
|
||||||
self.selectedVideoHandler?(url,asset)
|
self?.selectedVideoHandler?(url,asset)
|
||||||
|
self?.hide()
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
// self.hide()
|
//
|
||||||
self.selectedVideoHandler?(url,asset)
|
self?.selectedVideoHandler?(url,asset)
|
||||||
|
self?.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user