-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
544 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// | ||
// BaseSegementSlideDefaultViewController.swift | ||
// Example | ||
// | ||
// Created by Jiar on 2018/12/13. | ||
// Copyright © 2018 Jiar. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import SegementSlide | ||
|
||
class BaseSegementSlideDefaultViewController: SegementSlideDefaultViewController { | ||
|
||
override var switcherConfig: SegementSlideDefaultSwitcherConfig { | ||
return ConfigManager.shared.switcherConfig | ||
} | ||
|
||
override func scrollViewDidScroll(_ scrollView: UIScrollView, isParent: Bool) { | ||
super.scrollViewDidScroll(scrollView, isParent: isParent) | ||
guard isParent else { return } | ||
updateNavigationBarStyle(scrollView) | ||
} | ||
|
||
private func updateNavigationBarStyle(_ scrollView: UIScrollView) { | ||
if scrollView.contentOffset.y > headerStickyHeight { | ||
switcherView.layer.applySketchShadow(color: .black, alpha: 0.03, x: 0, y: 2.5, blur: 5) | ||
switcherView.layer.add(generateFadeAnimation(), forKey: "reloadSwitcherView") | ||
} else { | ||
switcherView.layer.applySketchShadow(color: .clear, alpha: 0, x: 0, y: 0, blur: 0) | ||
switcherView.layer.add(generateFadeAnimation(), forKey: "reloadSwitcherView") | ||
} | ||
} | ||
|
||
private func generateFadeAnimation() -> CATransition { | ||
let fadeTextAnimation = CATransition() | ||
fadeTextAnimation.duration = 0.25 | ||
fadeTextAnimation.type = .fade | ||
return fadeTextAnimation | ||
} | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
debugPrint("\(type(of: self)) - \(String(format: "%p", self)) - \(#function)") | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
debugPrint("\(type(of: self)) - \(String(format: "%p", self)) - \(#function)") | ||
} | ||
|
||
override func viewWillDisappear(_ animated: Bool) { | ||
super.viewWillDisappear(animated) | ||
debugPrint("\(type(of: self)) - \(String(format: "%p", self)) - \(#function)") | ||
} | ||
|
||
override func viewDidDisappear(_ animated: Bool) { | ||
super.viewDidDisappear(animated) | ||
debugPrint("\(type(of: self)) - \(String(format: "%p", self)) - \(#function)") | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
debugPrint("\(type(of: self)) - \(String(format: "%p", self)) - \(#function)") | ||
view.backgroundColor = .white | ||
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "more", style: .plain, target: self, action: #selector(moreAction)) | ||
} | ||
|
||
@objc | ||
private func moreAction() { | ||
let viewController: UIViewController | ||
switch Int.random(in: 0..<8) { | ||
case 0..<4: | ||
viewController = NoticeViewController(selectedIndex: Int.random(in: 0..<DataManager.shared.noticeLanguageTitles.count)) | ||
case 4: | ||
viewController = PostViewController(selectedIndex: Int.random(in: 0..<DataManager.shared.postLanguageTitles.count)) | ||
case 5: | ||
viewController = HomeViewController() | ||
case 6: | ||
viewController = ExploreViewController() | ||
case 7: | ||
viewController = MineViewController() | ||
default: | ||
viewController = NoticeViewController(selectedIndex: Int.random(in: 0..<DataManager.shared.noticeLanguageTitles.count)) | ||
} | ||
viewController.hidesBottomBarWhenPushed = Bool.random() | ||
navigationController?.pushViewController(viewController, animated: true) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.network.client</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.