Return examples
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Example Add Table View Controller-->
|
||||
<scene sceneID="0f9-5i-ygC">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ExampleAddTableViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="p3c-kf-PfN" customClass="ExampleAddTableViewController" customModule="ContainerController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="jmi-Lo-St4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="QCP-uk-H24"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="781.15942028985512" y="43.526785714285715"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ExampleAddTableViewController.swift
|
||||
// ContainerControllerSwift
|
||||
//
|
||||
// Created by mrustaa on 09.06.2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class ExampleAddTableViewController: StoryboardController {
|
||||
|
||||
var container: ContainerController!
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.backgroundShadowShow = true
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 100)
|
||||
container = ContainerController(addTo: self, layout: layout)
|
||||
container.view.cornerRadius = 15
|
||||
container.view.addShadow()
|
||||
container.add(scrollView: addTableView())
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
container.move(type: .top)
|
||||
}
|
||||
|
||||
func addTableView() -> UITableView {
|
||||
|
||||
let tableView = UITableView()
|
||||
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
return tableView
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Scroll Delegate
|
||||
|
||||
extension ExampleAddTableViewController: UIScrollViewDelegate {
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
container.scrollViewDidScroll(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
container.scrollViewWillBeginDragging(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
container.scrollViewDidEndDecelerating(scrollView)
|
||||
}
|
||||
|
||||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
container.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Table Delegate
|
||||
|
||||
extension ExampleAddTableViewController: UITableViewDelegate {
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
return 60
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Table DataSource
|
||||
|
||||
extension ExampleAddTableViewController: UITableViewDataSource {
|
||||
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 21
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
|
||||
cell.textLabel?.text = "item \(indexPath.row)"
|
||||
cell.backgroundColor = .clear
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ExampleAddTableViewControllerSettings.swift
|
||||
// ContainerControllerSwift
|
||||
//
|
||||
// Created by mrustaa on 09.06.2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
extension ExampleAddTableViewController {
|
||||
|
||||
// MARK: - Settings
|
||||
|
||||
func changeViewParametrs() {
|
||||
|
||||
container.view.cornerRadius = 15 // Change cornerRadius global
|
||||
container.view.addShadow(opacity: 0.1) // Add layer shadow
|
||||
container.view.addBlur(style: .dark) // Add background blur UIVisualEffectView
|
||||
}
|
||||
|
||||
func changeViewCustom() {
|
||||
|
||||
// Add custom shadow
|
||||
let layer = container.view.layer
|
||||
layer.shadowOpacity = 0.5
|
||||
layer.shadowColor = UIColor.red.cgColor
|
||||
layer.shadowOffset = CGSize(width: 1, height: 4)
|
||||
layer.shadowRadius = 5
|
||||
|
||||
// Add view in container.view
|
||||
let viewRed = UIView(frame: CGRect(x: 50, y: 50, width: 50, height: 50))
|
||||
viewRed.backgroundColor = .systemRed
|
||||
container.view.addSubview(viewRed)
|
||||
|
||||
// Add view under scrollView container.view
|
||||
let viewGreen = UIView(frame: CGRect(x: 25, y: 25, width: 50, height: 50))
|
||||
viewGreen.backgroundColor = .systemGreen
|
||||
container.view.insertSubview(viewGreen, at: 0)
|
||||
}
|
||||
|
||||
func createLayout() {
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.startPosition = .hide
|
||||
layout.backgroundShadowShow = false
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Change settings right away
|
||||
|
||||
func changeRightAway() {
|
||||
|
||||
// Properties
|
||||
container.set(movingEnabled: true)
|
||||
container.set(trackingPosition: false)
|
||||
container.set(footerPadding: 100)
|
||||
|
||||
// Add ScrollInsets Top/Bottom
|
||||
container.set(scrollIndicatorTop: 5) // ↓
|
||||
container.set(scrollIndicatorBottom: 5) // ↑
|
||||
|
||||
// Positions
|
||||
container.set(top: 70) // ↓
|
||||
container.set(middle: 250) // ↑
|
||||
container.set(bottom: 80) // ↑
|
||||
|
||||
// Middle Enable/Disable
|
||||
container.set(middle: 250)
|
||||
container.set(middle: nil)
|
||||
|
||||
// Background Shadow
|
||||
container.set(backgroundShadowShow: true)
|
||||
|
||||
// Insets View
|
||||
container.set(left: 5) // →
|
||||
container.set(right: 5) // ←
|
||||
|
||||
// Landscape params
|
||||
container.setLandscape(top: 30)
|
||||
container.setLandscape(middle: 150)
|
||||
container.setLandscape(bottom: 70)
|
||||
container.setLandscape(middle: nil)
|
||||
|
||||
container.setLandscape(backgroundShadowShow: false)
|
||||
|
||||
container.setLandscape(left: 10)
|
||||
container.setLandscape(right: 100)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user