|
@@ -20,7 +20,11 @@ class PublishNewViewController: BaseViewController {
|
|
|
|
|
|
deinit {
|
|
|
NXLLog("deinit")
|
|
|
- publishNewViewModel?.recorder?.destroy()
|
|
|
+ if publishNewVideoPhotoView.recorder != nil {
|
|
|
+ publishNewVideoPhotoView.recorder?.stopPreview()
|
|
|
+ publishNewVideoPhotoView.recorder?.destroy()
|
|
|
+ publishNewVideoPhotoView.recorder = nil
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -30,17 +34,18 @@ class PublishNewViewController: BaseViewController {
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
- setupData()
|
|
|
setupViews()
|
|
|
setupLayouts()
|
|
|
+ setupData()
|
|
|
}
|
|
|
|
|
|
override func setupViews() {
|
|
|
navigationBar.isHidden = true
|
|
|
- view.addSubview(publishNewAuthorizationView)
|
|
|
view.addSubview(scrollView)
|
|
|
scrollView.addSubview(publishNewVideoPhotoView)
|
|
|
view.addSubview(segmentedView)
|
|
|
+ view.addSubview(publishNewAuthorizationView)
|
|
|
+
|
|
|
}
|
|
|
override func setupLayouts() {
|
|
|
segmentedView.snp.makeConstraints { (make) in
|
|
@@ -66,7 +71,7 @@ class PublishNewViewController: BaseViewController {
|
|
|
/// 授权View
|
|
|
private lazy var publishNewAuthorizationView: PublishNewAuthorizationView = {
|
|
|
let publishNewAuthorizationView = PublishNewAuthorizationView()
|
|
|
- publishNewAuthorizationView.isHidden = false
|
|
|
+ publishNewAuthorizationView.isHidden = true
|
|
|
return publishNewAuthorizationView
|
|
|
}()
|
|
|
|
|
@@ -79,7 +84,7 @@ class PublishNewViewController: BaseViewController {
|
|
|
scrollView.showsVerticalScrollIndicator = false
|
|
|
scrollView.scrollsToTop = false
|
|
|
scrollView.isScrollEnabled = false
|
|
|
- scrollView.isHidden = true
|
|
|
+ scrollView.isHidden = false
|
|
|
return scrollView
|
|
|
}()
|
|
|
|
|
@@ -117,7 +122,6 @@ class PublishNewViewController: BaseViewController {
|
|
|
segmentedDataSource.isTitleStrokeWidthEnabled = true
|
|
|
//reloadData(selectedIndex:)方法一定要调用,方法内部会刷新数据源数组
|
|
|
segmentedDataSource.reloadData(selectedIndex: 0)
|
|
|
-
|
|
|
return segmentedDataSource
|
|
|
}()
|
|
|
|
|
@@ -159,17 +163,24 @@ extension PublishNewViewController : JXSegmentedViewDelegate {
|
|
|
segmentedDataSourceAlbum.reloadData(selectedIndex: 0)
|
|
|
segmentedView.dataSource = segmentedDataSourceAlbum
|
|
|
statusBarStyle = .default
|
|
|
+ //停止预览摄像头
|
|
|
+ publishNewVideoPhotoView.recorder?.stopPreview()
|
|
|
case 1:
|
|
|
scrollView.setContentOffset(CGPoint(x: kScreenWidth, y:0), animated: true)
|
|
|
segmentedDataSourceVideoPhoto.reloadData(selectedIndex: 1)
|
|
|
segmentedView.dataSource = segmentedDataSourceVideoPhoto
|
|
|
statusBarStyle = .lightContent
|
|
|
+ //开始预览摄像头
|
|
|
+ publishNewVideoPhotoView.recorder?.startPreview()
|
|
|
|
|
|
case 2:
|
|
|
scrollView.setContentOffset(CGPoint(x: kScreenWidth, y:0), animated: true)
|
|
|
segmentedDataSourceVideoPhoto.reloadData(selectedIndex: 2)
|
|
|
segmentedView.dataSource = segmentedDataSourceVideoPhoto
|
|
|
statusBarStyle = .lightContent
|
|
|
+ //开始预览摄像头
|
|
|
+ publishNewVideoPhotoView.recorder?.startPreview()
|
|
|
+
|
|
|
default:
|
|
|
break
|
|
|
}
|