Update (UI Design + ContainerController)
This commit is contained in:
1 parent
e87a0a40b6
commit
15bfb95e8a
11 files changed
+1418
-36
No files matched your search
+106
@@ -0,0 +1,106 @@
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class CryptoViewController: StoryboardController {
|
||||
|
||||
@IBOutlet weak var tableView: TableAdapterView!
|
||||
|
||||
var containers: [ContainerController] = []
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
self.navBarHide = true
|
||||
|
||||
title = "Crypto"
|
||||
let color1 = #colorLiteral(red: 0.1019607843, green: 0.168627451, blue: 0.4588235294, alpha: 1)
|
||||
|
||||
view.backgroundColor = color1
|
||||
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
items.append( CryptoTitleItem(state: .init() ) )
|
||||
tableView.set(items: items, animated: true)
|
||||
|
||||
|
||||
addContainerr(position: .init(top: 50, middle: 456, bottom: 100))
|
||||
}
|
||||
|
||||
func addContainerr(position: ContainerPosition) {
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = position //
|
||||
layoutC.insets = .init(right: 0, left: 0)
|
||||
var container = ContainerController(addTo: self, layout: layoutC)
|
||||
container.view.cornerRadius = 36
|
||||
container.view.addShadow()
|
||||
container.view.tag = 12
|
||||
container.delegate = self
|
||||
let shadowColor = UIColor.black.withAlphaComponent(0.1).cgColor
|
||||
|
||||
container.view.layer.shadowOpacity = Float(0.20)
|
||||
container.view.layer.shadowOffset = .init(width: 0, height: 13)
|
||||
container.view.layer.shadowRadius = 30.0
|
||||
container.view.layer.shadowColor = UIColor.black.cgColor
|
||||
|
||||
let fr = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 173)
|
||||
let header = CryptoHeaderView()
|
||||
header.frame = fr
|
||||
container.add(headerView: header)
|
||||
|
||||
|
||||
// let fr2 = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 98)
|
||||
// let footer = PlaylistFooterPlayView()
|
||||
// footer.frame = fr2
|
||||
// container.add(footerView: footer)
|
||||
|
||||
// var imgHeader = UIImage(named: "imgWalletsHeader2")?.withTintColor(color, renderingMode: .alwaysTemplate)
|
||||
|
||||
// let color1 = #colorLiteral(red: 0.1019607843, green: 0.168627451, blue: 0.4588235294, alpha: 1)
|
||||
|
||||
// var header = UIImageView(frame: CGRect(x: 0, y: 0, width: ScreenSize.width - 23 - 23 , height: 680)) //
|
||||
// header.image = imgHeader
|
||||
// header.tintColor = color
|
||||
//
|
||||
// // container.view.addSubview(header) //
|
||||
// container.view.insertSubview(header, at: 0)
|
||||
container.view.backgroundColor = .white
|
||||
// container.view.mask = header
|
||||
|
||||
// container.add(headerView: header)
|
||||
// container.view.backgroundColor = color
|
||||
|
||||
var table = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
table.indicatorStyle = .default
|
||||
// container.add(scrollView: addCollectionView())
|
||||
|
||||
|
||||
|
||||
let img1 = #imageLiteral(resourceName: "imgPlaylistMain")
|
||||
let img2 = #imageLiteral(resourceName: "imgPlaylistFlume")
|
||||
|
||||
|
||||
table.set(items: [
|
||||
CryptoOneItem(state: .init()),
|
||||
CryptoOneItem(state: .init()),
|
||||
CryptoOneItem(state: .init())
|
||||
] )
|
||||
|
||||
container.add(scrollView: table)
|
||||
container.move(type: .bottom)
|
||||
|
||||
main(delay: 1.05) {
|
||||
container.move(type: .middle
|
||||
)
|
||||
}
|
||||
|
||||
containers.append(container)
|
||||
|
||||
// self.view.addSubview(self.footerImg)
|
||||
}
|
||||
|
||||
override func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
if animation {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -107,7 +107,7 @@ class ExamplesSettingsViewController: StoryboardController {
|
||||
let subTitle = String(describing: type(of: container))
|
||||
let title = style.rawValue
|
||||
|
||||
items.append( TitleTextItem(title: title, subtitle: subTitle, editing: true) )
|
||||
items.append( TitleTextxItem(title: title, subtitle: subTitle, editing: true) )
|
||||
tableView?.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,41 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
@IBDesignable
|
||||
class StoryboardController: UIViewController {
|
||||
class StoryboardController: UIViewController {
|
||||
|
||||
var navBarHide: Bool = false
|
||||
|
||||
class func instantiate() -> UIViewController {
|
||||
return fromStoryboardController()
|
||||
}
|
||||
|
||||
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
if navBarHide {
|
||||
navigationController?.navigationBar.isTranslucent = false
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
navBar(hide: true)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
if navBarHide {
|
||||
navBar(hide: false)
|
||||
}
|
||||
}
|
||||
|
||||
func navBar(hide: Bool) {
|
||||
self.navigationController?.setNavigationBarHidden(hide, animated: true)
|
||||
}
|
||||
|
||||
class func fromStoryboardController() -> UIViewController {
|
||||
let className = String(describing: self)
|
||||
|
||||
@@ -29,3 +56,65 @@ class StoryboardController: UIViewController {
|
||||
return storyboard.instantiateViewController(withIdentifier: className)
|
||||
}
|
||||
}
|
||||
|
||||
extension StoryboardController: ContainerControllerDelegate {
|
||||
|
||||
|
||||
func addContainer(position: ContainerPosition, radius: CGFloat, items: [TableAdapterItem]? = nil, delegate: ContainerControllerDelegate? = nil, header: UIView? = nil, footer: UIView? = nil) -> ContainerController {
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = position //
|
||||
layoutC.insets = .init(right: 0, left: 0)
|
||||
var container = ContainerController(addTo: self, layout: layoutC)
|
||||
container.view.cornerRadius = radius
|
||||
container.view.addShadow()
|
||||
container.view.tag = 12
|
||||
if let delegate = delegate {
|
||||
container.delegate = delegate
|
||||
} else {
|
||||
container.delegate = self
|
||||
}
|
||||
let shadowColor = UIColor.black.withAlphaComponent(0.1).cgColor
|
||||
|
||||
container.view.layer.shadowOpacity = Float(0.20)
|
||||
container.view.layer.shadowOffset = .init(width: 0, height: 13)
|
||||
container.view.layer.shadowRadius = 30.0
|
||||
container.view.layer.shadowColor = UIColor.black.cgColor
|
||||
|
||||
|
||||
container.view.backgroundColor = .white
|
||||
// container.view.backgroundColor = color
|
||||
|
||||
if let headerV = header {
|
||||
container.add(headerView: headerV)
|
||||
}
|
||||
|
||||
if let footerV = footer {
|
||||
container.add(footerView: footerV)
|
||||
}
|
||||
|
||||
var table = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
table.indicatorStyle = .default
|
||||
// container.add(scrollView: addCollectionView())
|
||||
|
||||
if let items = items {
|
||||
table.set(items: items )
|
||||
}
|
||||
container.add(scrollView: table)
|
||||
container.move(type: .bottom)
|
||||
|
||||
main(delay: 1.05) {
|
||||
container.move(type: .top
|
||||
)
|
||||
}
|
||||
|
||||
return container
|
||||
}
|
||||
|
||||
|
||||
func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
if animation {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class ImagineViewController: StoryboardController {
|
||||
|
||||
@IBOutlet weak var tableView: TableAdapterView?
|
||||
|
||||
|
||||
// func navBar(hide: Bool) {
|
||||
// self.navigationController?.setNavigationBarHidden(hide, animated: true)
|
||||
// }
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
self.navBarHide = true
|
||||
|
||||
title = "Imagine"
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
items.append( ImagineHeaderSwitchItem(state: .init() ) )
|
||||
items.append( ImagineTitleItem(state: .init(titleText: "Imagine", subtitleText: "anything!") ) )
|
||||
items.append( ImagineTagItem(state: .init()) )
|
||||
items.append( ImagineCollectionItem(state: .init()) )
|
||||
items.append( ImagineButtonItem(state: .init(titleText: "Create New Image")) )
|
||||
|
||||
tableView?.set(items: items)// (items: items, animated: true)
|
||||
}
|
||||
}
|
||||
+238
@@ -0,0 +1,238 @@
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class PlaylistViewController: StoryboardController {
|
||||
@IBOutlet var imgView: UIImageView!
|
||||
|
||||
@IBOutlet var imgViewH: NSLayoutConstraint!
|
||||
@IBOutlet var imgViewW: NSLayoutConstraint!
|
||||
@IBOutlet var imgViewY: NSLayoutConstraint!
|
||||
@IBOutlet weak var tableView: TableAdapterView!
|
||||
var containers: [ContainerController] = []
|
||||
|
||||
var footerView: PlaylistFooterPlayView?
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
self.navBarHide = true
|
||||
|
||||
let color1 = #colorLiteral(red: 0.1273144384, green: 0.1311024159, blue: 0.1562976594, alpha: 1)
|
||||
|
||||
title = "Playlist"
|
||||
view.backgroundColor = color1
|
||||
|
||||
let img1 = #imageLiteral(resourceName: "imgPlaylistLandscape")
|
||||
|
||||
imgView.alpha = 1
|
||||
|
||||
self.imgView.layer.cornerRadius = 9
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
items.append( PlaylistTitleItem(state: .init(titleText: "New Releases", subtitleText: "More") ) )
|
||||
items.append( PlaylistCollectionsItem(state: .init(firstImage: img1, secondImage: img1)
|
||||
) )
|
||||
tableView.set(items: items, animated: true)
|
||||
|
||||
// let titleView = PlaylistTitleCell()
|
||||
// titleView.frame = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 148)
|
||||
// view.addSubview(titleView)
|
||||
//
|
||||
//
|
||||
// let titleView2 = PlaylistCollectionsCell()
|
||||
// titleView2.frame = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 162)
|
||||
// view.addSubview(titleView2)
|
||||
|
||||
addContainerr(position: .init(top: 50, middle: 310, bottom: 100))
|
||||
|
||||
|
||||
let fr2 = CGRect(x: 0, y: ScreenSize.height - 98, width: ScreenSize.width, height: 98)
|
||||
let footer = PlaylistFooterPlayView()
|
||||
footer.frame = fr2
|
||||
view.addSubview(footer)
|
||||
footerView = footer
|
||||
footerView?.clickCallback = {
|
||||
|
||||
if (self.containers.count != 0) {
|
||||
|
||||
self.containers[0].move(type: .middle)
|
||||
|
||||
}
|
||||
}
|
||||
self.footerView?.alpha = 0
|
||||
}
|
||||
|
||||
func addContainerr(position: ContainerPosition) {
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = position //
|
||||
layoutC.insets = .init(right: 0, left: 0)
|
||||
let container = ContainerController(addTo: self, layout: layoutC)
|
||||
container.view.cornerRadius = 22
|
||||
container.view.addShadow()
|
||||
container.view.tag = 12
|
||||
container.delegate = self
|
||||
// let shadowColor = UIColor.black.withAlphaComponent(0.1).cgColor
|
||||
|
||||
container.view.layer.shadowOpacity = Float(0.20)
|
||||
container.view.layer.shadowOffset = .init(width: 0, height: 13)
|
||||
container.view.layer.shadowRadius = 30.0
|
||||
container.view.layer.shadowColor = UIColor.black.cgColor
|
||||
|
||||
let fr = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 77)
|
||||
let header = PlaylistHeaderView()
|
||||
header.frame = fr
|
||||
container.add(headerView: header)
|
||||
|
||||
|
||||
let fr2 = CGRect(x: 0, y: 0, width: ScreenSize.width, height: 98)
|
||||
let footer = PlaylistFooterPlayView()
|
||||
footer.frame = fr2
|
||||
container.add(footerView: footer)
|
||||
|
||||
// var imgHeader = UIImage(named: "imgWalletsHeader2")?.withTintColor(color, renderingMode: .alwaysTemplate)
|
||||
|
||||
let color1 = #colorLiteral(red: 0.07450980392, green: 0.08235294118, blue: 0.1137254902, alpha: 1)
|
||||
|
||||
// var header = UIImageView(frame: CGRect(x: 0, y: 0, width: ScreenSize.width - 23 - 23 , height: 680)) //
|
||||
// header.image = imgHeader
|
||||
// header.tintColor = color
|
||||
//
|
||||
// // container.view.addSubview(header) //
|
||||
// container.view.insertSubview(header, at: 0)
|
||||
container.view.backgroundColor = color1
|
||||
// container.view.mask = header
|
||||
|
||||
// container.add(headerView: header)
|
||||
// container.view.backgroundColor = color
|
||||
|
||||
let table = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
table.indicatorStyle = .default
|
||||
// container.add(scrollView: addCollectionView())
|
||||
|
||||
|
||||
|
||||
let img1 = #imageLiteral(resourceName: "imgPlaylistMain")
|
||||
let img2 = #imageLiteral(resourceName: "imgPlaylistFlume")
|
||||
|
||||
|
||||
table.set(items: [
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Flume", text2: "What you need", text3: "4:10")),
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Martin Ikin", text2: "Headnoise", text3: "4:10")),
|
||||
|
||||
PlaylistOneItem(state: .init(firstImage: img1, subtitleText: "ZHU", text2: "Generationwhy", text3: "59:14")),
|
||||
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Flume", text2: "What you need", text3: "4:10")),
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Martin Ikin", text2: "Headnoise", text3: "4:10")),
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Flume", text2: "What you need", text3: "4:10")),
|
||||
|
||||
PlaylistOneItem(state: .init(firstImage: img1, subtitleText: "Flume", text2: "What you need", text3: "4:10")),
|
||||
PlaylistOneItem(state: .init(firstImage: img1, subtitleText: "Martin Ikin", text2: "Headnoise", text3: "4:10")),
|
||||
PlaylistOneItem(state: .init(firstImage: img2, subtitleText: "Flume", text2: "What you need", text3: "4:10"))
|
||||
] )
|
||||
|
||||
container.add(scrollView: table)
|
||||
container.move(type: .bottom)
|
||||
|
||||
main(delay: 1.05) {
|
||||
container.move(type: .middle
|
||||
)
|
||||
}
|
||||
|
||||
containers.append(container)
|
||||
|
||||
// self.view.addSubview(self.footerImg)
|
||||
}
|
||||
|
||||
|
||||
override func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
if animation {
|
||||
|
||||
|
||||
|
||||
if (containers.count != 0) {
|
||||
if type == .bottom {
|
||||
|
||||
containers[0].footerView?.alpha = 0
|
||||
|
||||
|
||||
containers[0].view.alpha = 0
|
||||
} else {
|
||||
containers[0].footerView?.alpha = 1
|
||||
containers[0].view.alpha = 1
|
||||
}
|
||||
}
|
||||
UIView.animate(withDuration: 0.35) {
|
||||
if type == .bottom { self.footerView?.alpha = 1 }
|
||||
else { self.footerView?.alpha = 0 }
|
||||
|
||||
}
|
||||
|
||||
// main {
|
||||
|
||||
if type == .bottom {
|
||||
|
||||
|
||||
|
||||
self.imgViewH.constant = ScreenSize.height
|
||||
self.imgViewW.constant = ScreenSize.width
|
||||
self.imgViewY.constant = 0
|
||||
|
||||
} else if type == .middle {
|
||||
|
||||
self.imgViewW.constant = 313
|
||||
self.imgViewH.constant = 162
|
||||
self.imgViewY.constant = 197
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
self.imgViewW.constant = 313
|
||||
self.imgViewH.constant = 162
|
||||
self.imgViewY.constant = 197
|
||||
|
||||
}
|
||||
|
||||
self.view.setNeedsUpdateConstraints()
|
||||
|
||||
|
||||
UIView.animate(withDuration: 2.5) {
|
||||
|
||||
self.view.layoutIfNeeded()
|
||||
|
||||
if type == .bottom {
|
||||
// self.imgView.alpha = 1
|
||||
|
||||
self.tableView.alpha = 1
|
||||
// self.imgViewH.constant = ScreenSize.height
|
||||
// self.imgViewW.constant = ScreenSize.width
|
||||
// self.imgViewY.constant = 0
|
||||
// self.imgView.layer.cornerRadius = 0
|
||||
|
||||
} else if type == .middle {
|
||||
self.tableView.alpha = 1
|
||||
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
|
||||
// self.imgView.alpha = 1
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
|
||||
} else {
|
||||
|
||||
// self.imgViewW.constant = 313
|
||||
// self.imgViewH.constant = 162
|
||||
// self.imgViewY.constant = 196
|
||||
|
||||
self.tableView.alpha = 0
|
||||
// self.imgView.layer.cornerRadius = 9
|
||||
}
|
||||
}
|
||||
|
||||
// } //
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ class TaxiViewController: StoryboardController {
|
||||
@IBOutlet weak var mapView: MKMapView!
|
||||
var mapManager: MapViewManager!
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
@@ -23,10 +23,19 @@ class ViewController: UIViewController {
|
||||
navigationController?.interactivePopGestureRecognizer?.isEnabled = true
|
||||
navigationController?.view.backgroundColor = .systemGroupedBackground
|
||||
items = [
|
||||
TitleTextItem(title: "Maps.app", clss: MapsViewController.self),
|
||||
TitleTextItem(title: "Example. Settings", clss: ExamplesSettingsViewController.self),
|
||||
TitleTextItem(title: "Example. Add UITableView", clss: ExampleAddTableViewController.self),
|
||||
TitleTextItem(title: "Example. Add UICollectionView", clss: ExampleAddCollectionViewController.self)
|
||||
TitleTextxItem(title: "Maps.app", clss: MapsViewController.self),
|
||||
TitleTextxItem(title: "Example. Settings", clss: ExamplesSettingsViewController.self),
|
||||
TitleTextxItem(title: "Example. Add UITableView", clss: ExampleAddTableViewController.self),
|
||||
TitleTextxItem(title: "Example. Add UICollectionView", clss: ExampleAddCollectionViewController.self),
|
||||
|
||||
TitleTextxItem(title: "Imagine", clss: ImagineViewController.self),
|
||||
TitleTextxItem(title: "Playlist", clss: PlaylistViewController.self),
|
||||
TitleTextxItem(title: "Crypto", clss: CryptoViewController.self),
|
||||
|
||||
TitleTextxItem(title: "Wallets", clss: WalletsViewController.self),
|
||||
TitleTextxItem(title: "Taxi ", clss: TaxiViewController.self)
|
||||
|
||||
|
||||
]
|
||||
|
||||
tableView?.set(items: items, animated: true)
|
||||
@@ -35,7 +44,7 @@ class ViewController: UIViewController {
|
||||
tableView?.selectIndexCallback = { [weak self] (index: Int) in
|
||||
guard let _self = self else { return }
|
||||
|
||||
guard let data = _self.tableView?.items[index].cellData as? TitleTextCellData else { return }
|
||||
guard let data = _self.tableView?.items[index].cellData as? TitleTextxCellData else { return }
|
||||
guard let storyboardClass = data.clss as? StoryboardController.Type else { return }
|
||||
let vc = storyboardClass.instantiate()
|
||||
|
||||
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class WalletsViewController: StoryboardController {
|
||||
|
||||
@IBOutlet var footerImg: UIImageView!
|
||||
@IBOutlet weak var tableView: TableAdapterView!
|
||||
var containers: [ContainerController] = []
|
||||
|
||||
var open1: Bool = true
|
||||
var open2: Bool = true
|
||||
var open3: Bool = true
|
||||
var open4: Bool = true
|
||||
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
self.navBarHide = true
|
||||
|
||||
let color1 = #colorLiteral(red: 1, green: 0.5607843137, blue: 0.2901960784, alpha: 1)
|
||||
let color2 = #colorLiteral(red: 0.2862745098, green: 0.3450980392, blue: 0.7921568627, alpha: 1)
|
||||
let color3 = #colorLiteral(red: 0.8156862745, green: 0.8117647059, blue: 0.9647058824, alpha: 1)
|
||||
let color4 = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
|
||||
// let padding: CGFloat = 26 + 24
|
||||
|
||||
|
||||
let img1 = #imageLiteral(resourceName: "imgWalletsBitcoin")
|
||||
let img2 = #imageLiteral(resourceName: "imgWalletsEthereum")
|
||||
let img3 = #imageLiteral(resourceName: "imgWalletsDigiByte")
|
||||
let img4 = #imageLiteral(resourceName: "imgWalletsLitecoin")
|
||||
//
|
||||
// container.move(type: container.moveType)
|
||||
|
||||
|
||||
addContainer(position: getPosition(index: 0), title: "Bitcoin", sum: "$14.20", color: color1, img: img1 , dark: true)
|
||||
|
||||
main(delay: 0.05) {
|
||||
self.addContainer(position: self.getPosition(index: 1), title: "Ethereum", sum: "$9.49",color: color2, img: img2)
|
||||
}
|
||||
main(delay: 0.15) {
|
||||
self.addContainer(position: self.getPosition(index: 2), title: "DigiByte", sum: "$23.65", color: color3, img:img3 , dark: true)
|
||||
}
|
||||
main(delay: 0.20) {
|
||||
self.addContainer(position: self.getPosition(index: 3), title: "Litecoin", sum: "$43.20",color: color4, img: img4)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
title = "Wallets"
|
||||
|
||||
let imgImagine = #imageLiteral(resourceName: "iconWalletsMore")
|
||||
var items: [TableAdapterItem] = []
|
||||
items.append( WalletsTitleItem(state: .init(firstImage: imgImagine, subtitleText: "My Wallets" , text2: "$55,849.20", text3: "Total balance") ) )
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
override func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
|
||||
|
||||
print(" containerControllerMove \(containerController.view.tag) \(type == .top ? "TOP" : "BOTTOM") \(animation) \(open1) \(open2) \(open3) \(open4) ")
|
||||
|
||||
|
||||
|
||||
if animation && self.containers.count == 4 {
|
||||
|
||||
|
||||
switch containerController.view.tag {
|
||||
case 0:
|
||||
|
||||
if open1 {
|
||||
|
||||
if self.open2 {
|
||||
self.containers[1].move(type: .bottom)
|
||||
}
|
||||
if self.open3 {
|
||||
self.containers[2].move(type: .bottom)
|
||||
}
|
||||
if self.open4 {
|
||||
self.containers[3].move(type: .bottom)
|
||||
}
|
||||
} else {
|
||||
if !self.open2 {
|
||||
self.containers[1].move(type: .top)
|
||||
}
|
||||
if !self.open3 {
|
||||
self.containers[2].move(type: .top)
|
||||
}
|
||||
if !self.open4 {
|
||||
self.containers[3].move(type: .top)
|
||||
}
|
||||
}
|
||||
|
||||
case 1:
|
||||
if open2 {
|
||||
|
||||
if self.open3 {
|
||||
self.containers[2].move(type: .bottom)
|
||||
}
|
||||
if self.open4 {
|
||||
self.containers[3].move(type: .bottom)
|
||||
}
|
||||
} else {
|
||||
if !self.open3 {
|
||||
self.containers[2].move(type: .top)
|
||||
}
|
||||
if !self.open4 {
|
||||
self.containers[3].move(type: .top)
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
if open3 {
|
||||
|
||||
if self.open4 {
|
||||
self.containers[3].move(type: .bottom)
|
||||
}
|
||||
} else {
|
||||
if !self.open4 {
|
||||
self.containers[3].move(type: .top)
|
||||
}
|
||||
}
|
||||
case 3: break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
switch containerController.view.tag {
|
||||
case 0: open1 = (type == .top)
|
||||
case 1: open2 = (type == .top)
|
||||
case 2: open3 = (type == .top)
|
||||
case 3: open4 = (type == .top)
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
|
||||
// return
|
||||
//
|
||||
// var i = 0
|
||||
// for containr in containers {
|
||||
//
|
||||
//
|
||||
// let layoutC = ContainerLayout()
|
||||
// layoutC.positions = getPosition(index: i) //
|
||||
// layoutC.insets = .init(right: 23, left: 23)
|
||||
//// containr.middleEnable
|
||||
//
|
||||
// containers[i].set(layout: layoutC)
|
||||
// containr.set(layout: layoutC)
|
||||
//
|
||||
// i = i + 1
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
func getPosition(index: Int) -> ContainerPosition {
|
||||
let pa: CGFloat = 36
|
||||
|
||||
|
||||
|
||||
// switch index {
|
||||
// case 0: return ContainerPosition(top: 268 , middle: 268 - (open2 ? 0 : pa) - (open3 ? 0 : pa) - (open4 ? 0 : pa) , bottom: 170 )
|
||||
// case 1: return ContainerPosition(top: 368 , middle: 368 - (open3 ? 0 : pa) - (open4 ? 0 : pa), bottom: 140 )
|
||||
// case 2: return ContainerPosition(top: 468 , middle: 468 - (open4 ? 0 : pa), bottom: 110 )
|
||||
// case 3: return ContainerPosition(top: 568 , bottom: 80 )
|
||||
// default:
|
||||
// return ContainerPosition(top: 500, bottom: 80)
|
||||
// }
|
||||
|
||||
switch index {
|
||||
case 0: return ContainerPosition(top: 268 , bottom: 170 + pa )
|
||||
case 1: return ContainerPosition(top: 368 , bottom: 140 + pa )
|
||||
case 2: return ContainerPosition(top: 468 , bottom: 110 + pa )
|
||||
case 3: return ContainerPosition(top: 568 , bottom: 80 + pa )
|
||||
default:
|
||||
return ContainerPosition(top: 500, bottom: 80)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
func addContainer(position: ContainerPosition, title: String, sum: String, color: UIColor, img: UIImage, dark: Bool = false) {
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = position //
|
||||
layoutC.insets = .init(right: 23, left: 23)
|
||||
let container = ContainerController(addTo: self, layout: layoutC)
|
||||
container.view.cornerRadius = 22
|
||||
container.view.addShadow()
|
||||
container.view.tag = containers.count
|
||||
container.delegate = self
|
||||
// let shadowColor = UIColor.black.withAlphaComponent(0.1).cgColor
|
||||
|
||||
container.view.layer.shadowOpacity = Float(0.20)
|
||||
container.view.layer.shadowOffset = .init(width: 0, height: 13)
|
||||
container.view.layer.shadowRadius = 30.0
|
||||
container.view.layer.shadowColor = UIColor.black.cgColor
|
||||
|
||||
|
||||
|
||||
|
||||
let imgHeader = UIImage(named: "imgWalletsHeader2")?.withTintColor(color, renderingMode: .alwaysTemplate)
|
||||
|
||||
|
||||
let header = UIImageView(frame: CGRect(x: 0, y: 0, width: ScreenSize.width - 23 - 23 , height: 680)) //
|
||||
header.image = imgHeader
|
||||
header.tintColor = color
|
||||
|
||||
// container.view.addSubview(header) //
|
||||
container.view.insertSubview(header, at: 0)
|
||||
container.view.backgroundColor = .clear
|
||||
// container.view.mask = header
|
||||
|
||||
// container.add(headerView: header)
|
||||
// container.view.backgroundColor = color
|
||||
|
||||
let table = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
table.indicatorStyle = .default
|
||||
// container.add(scrollView: addCollectionView())
|
||||
table.set(items: [
|
||||
WalletsContainerItemItem(state: .init(
|
||||
|
||||
img: img,
|
||||
titleText: title,
|
||||
subtitleText: "2.73 LTC",
|
||||
text2: sum,
|
||||
text3: "+1.45 (345)",
|
||||
text4: "1LTC = $2983.40",
|
||||
text5: "~ 2.70%",
|
||||
text6: "Buy",
|
||||
dark: dark
|
||||
))
|
||||
] )
|
||||
|
||||
container.add(scrollView: table)
|
||||
container.move(type: .top)
|
||||
|
||||
containers.append(container)
|
||||
|
||||
self.view.addSubview(self.footerImg)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user