|
@@ -10,6 +10,17 @@ import JXPagingView
|
|
|
|
|
|
class TSTutorialPopupVC: TSBaseVC {
|
|
class TSTutorialPopupVC: TSBaseVC {
|
|
|
|
|
|
|
|
+ var selectedIndex:Int
|
|
|
|
+
|
|
|
|
+ init(selectedIndex: Int) {
|
|
|
|
+ self.selectedIndex = selectedIndex
|
|
|
|
+ super.init()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @MainActor required init?(coder: NSCoder) {
|
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
|
+ }
|
|
|
|
+
|
|
var tableHeaderViewHeight: CGFloat = 0.0
|
|
var tableHeaderViewHeight: CGFloat = 0.0
|
|
var headerInSectionHeight: Int = 44
|
|
var headerInSectionHeight: Int = 44
|
|
let titles:[String] = ["Contact Poster".localized,"Contact Photo".localized]
|
|
let titles:[String] = ["Contact Poster".localized,"Contact Photo".localized]
|
|
@@ -17,7 +28,7 @@ class TSTutorialPopupVC: TSBaseVC {
|
|
let popupContentViewH:CGFloat = k_ScreenHeight - 268.0
|
|
let popupContentViewH:CGFloat = k_ScreenHeight - 268.0
|
|
|
|
|
|
lazy var popupContentView: UIView = {
|
|
lazy var popupContentView: UIView = {
|
|
- let popupContentView = UIView()
|
|
|
|
|
|
+ let popupContentView = UIView(frame: CGRectMake(0, 0, popupContentViewW, popupContentViewH))
|
|
popupContentView.backgroundColor = .cardColor
|
|
popupContentView.backgroundColor = .cardColor
|
|
popupContentView.cornerRadius = 20.0
|
|
popupContentView.cornerRadius = 20.0
|
|
return popupContentView
|
|
return popupContentView
|
|
@@ -41,7 +52,6 @@ class TSTutorialPopupVC: TSBaseVC {
|
|
lazy var indicator: JXSegmentedIndicatorBackgroundView = {
|
|
lazy var indicator: JXSegmentedIndicatorBackgroundView = {
|
|
let indicator = JXSegmentedIndicatorBackgroundView()
|
|
let indicator = JXSegmentedIndicatorBackgroundView()
|
|
indicator.isIndicatorConvertToItemFrameEnabled = true
|
|
indicator.isIndicatorConvertToItemFrameEnabled = true
|
|
- indicator.isIndicatorConvertToItemFrameEnabled = true
|
|
|
|
indicator.indicatorHeight = 2
|
|
indicator.indicatorHeight = 2
|
|
indicator.indicatorPosition = .bottom
|
|
indicator.indicatorPosition = .bottom
|
|
|
|
|
|
@@ -52,7 +62,6 @@ class TSTutorialPopupVC: TSBaseVC {
|
|
gradientView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
gradientView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
gradientView.cornerRadius = 1
|
|
gradientView.cornerRadius = 1
|
|
indicator.addSubview(gradientView)
|
|
indicator.addSubview(gradientView)
|
|
- indicator.addSubview(gradientView)
|
|
|
|
|
|
|
|
return indicator
|
|
return indicator
|
|
}()
|
|
}()
|
|
@@ -65,41 +74,60 @@ class TSTutorialPopupVC: TSBaseVC {
|
|
segmentedView.backgroundColor = .clear
|
|
segmentedView.backgroundColor = .clear
|
|
segmentedView.contentEdgeInsetLeft = 26
|
|
segmentedView.contentEdgeInsetLeft = 26
|
|
segmentedView.listContainer = pagingView.listContainerView
|
|
segmentedView.listContainer = pagingView.listContainerView
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ let lineView = UIView()
|
|
|
|
+ lineView.backgroundColor = .white.withAlphaComponent(0.2)
|
|
|
|
+ segmentedView.addSubview(lineView)
|
|
|
|
+ lineView.snp.makeConstraints { make in
|
|
|
|
+ make.bottom.equalToSuperview()
|
|
|
|
+ make.leading.trailing.equalTo(0)
|
|
|
|
+ make.height.equalTo(1)
|
|
|
|
+ }
|
|
|
|
+
|
|
return segmentedView
|
|
return segmentedView
|
|
}()
|
|
}()
|
|
|
|
|
|
lazy var pagingView: JXPagingView = {
|
|
lazy var pagingView: JXPagingView = {
|
|
let pagingView = JXPagingView(delegate: self)
|
|
let pagingView = JXPagingView(delegate: self)
|
|
pagingView.mainTableView.backgroundColor = .clear
|
|
pagingView.mainTableView.backgroundColor = .clear
|
|
- pagingView.frame = CGRect(x: 0, y: 0, width:popupContentViewW, height:popupContentViewH)
|
|
|
|
|
|
+ pagingView.frame = CGRect(x: 0, y: 25, width:popupContentViewW, height:popupContentViewH-72-25)
|
|
pagingView.listContainerView.listCellBackgroundColor = .clear
|
|
pagingView.listContainerView.listCellBackgroundColor = .clear
|
|
//扣边返回处理,下面的代码要加上
|
|
//扣边返回处理,下面的代码要加上
|
|
pagingView.listContainerView.scrollView.panGestureRecognizer.require(toFail: self.navigationController!.interactivePopGestureRecognizer!)
|
|
pagingView.listContainerView.scrollView.panGestureRecognizer.require(toFail: self.navigationController!.interactivePopGestureRecognizer!)
|
|
pagingView.mainTableView.panGestureRecognizer.require(toFail: self.navigationController!.interactivePopGestureRecognizer!)
|
|
pagingView.mainTableView.panGestureRecognizer.require(toFail: self.navigationController!.interactivePopGestureRecognizer!)
|
|
- pagingView.pinSectionHeaderVerticalOffset = Int(TSTGPTitleView.viewH)
|
|
|
|
return pagingView
|
|
return pagingView
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
+ lazy var confirmBtn: UIButton = {
|
|
|
|
+ let confirmBtn = UIButton.createButton(title: "OK".localized, backgroundColor: "#111111".uiColor,font:.font(size: 18),titleColor: .themeColor,corner: 24){ [weak self] in
|
|
|
|
+ guard let self = self else { return }
|
|
|
|
+ dismiss()
|
|
|
|
+ }
|
|
|
|
+ return confirmBtn
|
|
|
|
+ }()
|
|
|
|
+
|
|
override func createView() {
|
|
override func createView() {
|
|
|
|
|
|
setNavBarViewHidden(true)
|
|
setNavBarViewHidden(true)
|
|
view.backgroundColor = .black.withAlphaComponent(0.7)
|
|
view.backgroundColor = .black.withAlphaComponent(0.7)
|
|
|
|
|
|
-
|
|
|
|
- view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickView)))
|
|
|
|
-
|
|
|
|
contentView.addSubview(popupContentView)
|
|
contentView.addSubview(popupContentView)
|
|
- popupContentView.snp.makeConstraints { make in
|
|
|
|
- make.center.equalToSuperview()
|
|
|
|
- make.width.equalTo(popupContentViewW)
|
|
|
|
- make.height.equalTo(popupContentViewH)
|
|
|
|
- }
|
|
|
|
|
|
+ popupContentView.center = view.center
|
|
createSegmentedView()
|
|
createSegmentedView()
|
|
|
|
+
|
|
|
|
+ popupContentView.addSubview(confirmBtn)
|
|
|
|
+ confirmBtn.snp.makeConstraints { make in
|
|
|
|
+ make.bottom.equalTo(-24)
|
|
|
|
+ make.centerX.equalToSuperview()
|
|
|
|
+ make.width.equalTo(250)
|
|
|
|
+ make.height.equalTo(48)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ segmentedView.defaultSelectedIndex = selectedIndex
|
|
}
|
|
}
|
|
-
|
|
|
|
- @objc func clickView() {
|
|
|
|
- self.dismiss()
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
extension TSTutorialPopupVC {
|
|
extension TSTutorialPopupVC {
|
|
@@ -132,7 +160,7 @@ extension TSTutorialPopupVC: JXPagingViewDelegate {
|
|
}
|
|
}
|
|
|
|
|
|
func pagingView(_ pagingView: JXPagingView, initListAtIndex index: Int) -> JXPagingViewListViewDelegate {
|
|
func pagingView(_ pagingView: JXPagingView, initListAtIndex index: Int) -> JXPagingViewListViewDelegate {
|
|
- return TSTutorialPopupView()
|
|
|
|
|
|
+ return TSTutorialPopupView(selectedIndex: index)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -146,31 +174,67 @@ extension TSTutorialPopupVC: JXPagingViewDelegate {
|
|
return stackView
|
|
return stackView
|
|
}()
|
|
}()
|
|
|
|
|
|
|
|
+ var selectedIndex:Int
|
|
|
|
+ init(selectedIndex: Int) {
|
|
|
|
+ self.selectedIndex = selectedIndex
|
|
|
|
+ super.init(frame: .zero)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @MainActor required init?(coder: NSCoder) {
|
|
|
|
+ fatalError("init(coder:) has not been implemented")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let popupContentView = TSTutorialPopupContentView()
|
|
|
|
+
|
|
public override func creatUI() {
|
|
public override func creatUI() {
|
|
- self.backgroundColor = .random
|
|
|
|
-
|
|
|
|
contentView.addSubview(stackView)
|
|
contentView.addSubview(stackView)
|
|
stackView.snp.makeConstraints { make in
|
|
stackView.snp.makeConstraints { make in
|
|
make.edges.equalToSuperview()
|
|
make.edges.equalToSuperview()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ stackView.addSubviewToStack(popupContentView)
|
|
|
|
+ popupContentView.snp.makeConstraints { make in
|
|
|
|
+ make.height.equalTo(404*kDesignScale)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public override func dealThings() {
|
|
|
|
+ var imageNamed0 = ""
|
|
|
|
+ var imageNamed1 = ""
|
|
|
|
+ var info = ""
|
|
|
|
+
|
|
|
|
+ if selectedIndex == 0 {
|
|
|
|
+ imageNamed0 = "tutorial_poster_0"
|
|
|
|
+ imageNamed1 = "tutorial_poster_1"
|
|
|
|
+ info = """
|
|
|
|
+ A new iOS 17 feature that creates a full-screen customizable visual identity for incoming calls. It combines photos, text (name), colors, and fonts, acting like a personalized "wallpaper" for your contact card.
|
|
|
|
+ """.localized
|
|
|
|
+ }else{
|
|
|
|
+ imageNamed0 = "tutorial_photo_0"
|
|
|
|
+ imageNamed1 = "tutorial_photo_1"
|
|
|
|
+ info = """
|
|
|
|
+ A small circular thumbnail image linked to a contact, displayed in apps like Contacts, Messages, or call logs
|
|
|
|
+ """.localized
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ popupContentView.imageView0.image = UIImage(named: imageNamed0)
|
|
|
|
+ popupContentView.imageView1.image = UIImage(named: imageNamed1)
|
|
|
|
+ popupContentView.infoLabel.text = info
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
extension TSTutorialPopupView: JXPagingViewListViewDelegate,UIScrollViewDelegate {
|
|
extension TSTutorialPopupView: JXPagingViewListViewDelegate,UIScrollViewDelegate {
|
|
|
|
|
|
-// public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
|
|
|
-// self.listViewDidScrollCallback?(scrollView)
|
|
|
|
-// }
|
|
|
|
|
|
+ public func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
|
|
|
+ self.listViewDidScrollCallback?(scrollView)
|
|
|
|
+ }
|
|
|
|
|
|
public func listScrollView() -> UIScrollView {
|
|
public func listScrollView() -> UIScrollView {
|
|
- return UIScrollView()
|
|
|
|
-// return stackView.scrollView
|
|
|
|
|
|
+ return stackView.scrollView
|
|
}
|
|
}
|
|
|
|
|
|
public func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> ()) {
|
|
public func listViewDidScrollCallback(callback: @escaping (UIScrollView) -> ()) {
|
|
-// self.listViewDidScrollCallback = callback
|
|
|
|
- callback(UIScrollView())
|
|
|
|
|
|
+ listViewDidScrollCallback = callback
|
|
}
|
|
}
|
|
|
|
|
|
public func listView() -> UIView {
|
|
public func listView() -> UIView {
|
|
@@ -178,3 +242,67 @@ extension TSTutorialPopupView: JXPagingViewListViewDelegate,UIScrollViewDelegate
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class TSTutorialPopupContentView: TSBaseView {
|
|
|
|
+
|
|
|
|
+ lazy var imageView0: UIImageView = {
|
|
|
|
+ let imageView = UIImageView()
|
|
|
|
+ imageView.contentMode = .scaleAspectFill
|
|
|
|
+ imageView.cornerRadius = 16
|
|
|
|
+ return imageView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ lazy var imageView1: UIImageView = {
|
|
|
|
+ let imageView = UIImageView()
|
|
|
|
+ imageView.contentMode = .scaleAspectFill
|
|
|
|
+ imageView.cornerRadius = 16
|
|
|
|
+ return imageView
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ lazy var infoLabel: UILabel = {
|
|
|
|
+ let infoLabel = UILabel.createLabel(font: .font(size: 14),textColor: .white.withAlphaComponent(0.8),textAlignment: .center,numberOfLines: 0)
|
|
|
|
+ return infoLabel
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ override func creatUI() {
|
|
|
|
+
|
|
|
|
+ let centerLineView = UIView()
|
|
|
|
+ centerLineView.backgroundColor = .clear
|
|
|
|
+
|
|
|
|
+ contentView.addSubview(centerLineView)
|
|
|
|
+ contentView.addSubview(imageView0)
|
|
|
|
+ contentView.addSubview(imageView1)
|
|
|
|
+ contentView.addSubview(infoLabel)
|
|
|
|
+
|
|
|
|
+ centerLineView.snp.makeConstraints { make in
|
|
|
|
+ make.center.equalToSuperview()
|
|
|
|
+ make.width.equalTo(1)
|
|
|
|
+ make.height.equalTo(1)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ imageView0.snp.makeConstraints { make in
|
|
|
|
+ make.top.equalTo(20)
|
|
|
|
+ make.trailing.equalTo(centerLineView.snp.leading).offset(-10)
|
|
|
|
+ make.width.equalTo(98*kDesignScale)
|
|
|
|
+ make.height.equalTo(218*kDesignScale)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ imageView1.snp.makeConstraints { make in
|
|
|
|
+ make.top.equalTo(20)
|
|
|
|
+ make.leading.equalTo(centerLineView.snp.trailing).offset(10)
|
|
|
|
+ make.width.equalTo(98*kDesignScale)
|
|
|
|
+ make.height.equalTo(218*kDesignScale)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ infoLabel.snp.makeConstraints { make in
|
|
|
|
+ make.top.equalTo(imageView0.snp.bottom).offset(20)
|
|
|
|
+ make.leading.bottom.equalTo(20)
|
|
|
|
+ make.trailing.equalTo(-20)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|