mirror of https://github.com/SnapKit/SnapKit
updates
This commit is contained in:
parent
60ebb0e45b
commit
a231343050
|
@ -12,7 +12,7 @@ import SnapKit
|
||||||
class ListViewController: UITableViewController {
|
class ListViewController: UITableViewController {
|
||||||
|
|
||||||
let kCellIdentifier = "CellIdentifier"
|
let kCellIdentifier = "CellIdentifier"
|
||||||
let demos = ["Basic UIScrollView"]
|
let demos = ["Simple Layout", "Basic UIScrollView"]
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
@ -36,6 +36,9 @@ class ListViewController: UITableViewController {
|
||||||
|
|
||||||
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
||||||
if indexPath.row == 0 {
|
if indexPath.row == 0 {
|
||||||
|
let viewController = SimpleLayoutViewController()
|
||||||
|
navigationController?.pushViewController(viewController, animated: true)
|
||||||
|
} else if indexPath.row == 1 {
|
||||||
let viewController = BasicUIScrollViewController()
|
let viewController = BasicUIScrollViewController()
|
||||||
navigationController?.pushViewController(viewController, animated: true)
|
navigationController?.pushViewController(viewController, animated: true)
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ class BasicUIScrollViewController: UIViewController {
|
||||||
|
|
||||||
view.addSubview(scrollView)
|
view.addSubview(scrollView)
|
||||||
|
|
||||||
contentView.backgroundColor = UIColor.redColor()
|
contentView.backgroundColor = UIColor.lightGrayColor()
|
||||||
scrollView.addSubview(contentView)
|
scrollView.addSubview(contentView)
|
||||||
contentView.addSubview(label)
|
contentView.addSubview(label)
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ class BasicUIScrollViewController: UIViewController {
|
||||||
override func updateViewConstraints() {
|
override func updateViewConstraints() {
|
||||||
|
|
||||||
if (!didSetupConstraints) {
|
if (!didSetupConstraints) {
|
||||||
|
|
||||||
scrollView.snp_makeConstraints { (make) -> Void in
|
scrollView.snp_makeConstraints { (make) -> Void in
|
||||||
make.edges.equalTo(view).inset(UIEdgeInsetsZero)
|
make.edges.equalTo(view).inset(UIEdgeInsetsZero)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
//
|
||||||
|
// SimpleLayoutViewController.swift
|
||||||
|
// SnapKit
|
||||||
|
//
|
||||||
|
// Created by Spiros Gerokostas on 01/03/16.
|
||||||
|
// Copyright © 2016 SnapKit Team. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
class SimpleLayoutViewController: UIViewController {
|
||||||
|
|
||||||
|
var didSetupConstraints = false
|
||||||
|
|
||||||
|
let blackView: UIView = {
|
||||||
|
let view = UIView()
|
||||||
|
view.backgroundColor = .blackColor()
|
||||||
|
return view
|
||||||
|
}()
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
view.backgroundColor = UIColor.whiteColor()
|
||||||
|
|
||||||
|
view.addSubview(blackView)
|
||||||
|
|
||||||
|
view.setNeedsUpdateConstraints()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func updateViewConstraints() {
|
||||||
|
|
||||||
|
if (!didSetupConstraints) {
|
||||||
|
|
||||||
|
blackView.snp_makeConstraints(closure: { (make) -> Void in
|
||||||
|
make.center.equalTo(view)
|
||||||
|
make.size.equalTo(CGSizeMake(100.0, 100.0))
|
||||||
|
})
|
||||||
|
|
||||||
|
didSetupConstraints = true
|
||||||
|
}
|
||||||
|
|
||||||
|
super.updateViewConstraints()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -30,6 +30,7 @@
|
||||||
56A0DC1D1C859E9A005973AB /* SnapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
56A0DC1D1C859E9A005973AB /* SnapKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||||
56A0DC221C859F15005973AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A0DC211C859F15005973AB /* AppDelegate.swift */; };
|
56A0DC221C859F15005973AB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A0DC211C859F15005973AB /* AppDelegate.swift */; };
|
||||||
56A0DC321C85A2C1005973AB /* BasicUIScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */; };
|
56A0DC321C85A2C1005973AB /* BasicUIScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */; };
|
||||||
|
56A0DC341C85AFBF005973AB /* SimpleLayoutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A0DC331C85AFBF005973AB /* SimpleLayoutViewController.swift */; };
|
||||||
EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; };
|
EE4910981B19A26000A54F1F /* ViewController+SnapKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */; };
|
||||||
EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; };
|
EE4910991B19A40200A54F1F /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEBCC9D819CC627D0083B827 /* SnapKit.framework */; };
|
||||||
EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; };
|
EE94F6091AC0F10A008767FF /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE94F6081AC0F10A008767FF /* UIKit.framework */; };
|
||||||
|
@ -105,6 +106,7 @@
|
||||||
56A0DC171C859E30005973AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
56A0DC171C859E30005973AB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
56A0DC211C859F15005973AB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
56A0DC211C859F15005973AB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicUIScrollViewController.swift; sourceTree = "<group>"; };
|
56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasicUIScrollViewController.swift; sourceTree = "<group>"; };
|
||||||
|
56A0DC331C85AFBF005973AB /* SimpleLayoutViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimpleLayoutViewController.swift; sourceTree = "<group>"; };
|
||||||
EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ViewController+SnapKit.swift"; sourceTree = "<group>"; };
|
EE4910971B19A26000A54F1F /* ViewController+SnapKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ViewController+SnapKit.swift"; sourceTree = "<group>"; };
|
||||||
EE94F6081AC0F10A008767FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
EE94F6081AC0F10A008767FF /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
|
||||||
EE94F60A1AC0F10F008767FF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
|
EE94F60A1AC0F10F008767FF /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
|
@ -206,6 +208,7 @@
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */,
|
56A0DC311C85A2C1005973AB /* BasicUIScrollViewController.swift */,
|
||||||
|
56A0DC331C85AFBF005973AB /* SimpleLayoutViewController.swift */,
|
||||||
);
|
);
|
||||||
path = demos;
|
path = demos;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -582,6 +585,7 @@
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
56A0DC341C85AFBF005973AB /* SimpleLayoutViewController.swift in Sources */,
|
||||||
56A0DC221C859F15005973AB /* AppDelegate.swift in Sources */,
|
56A0DC221C859F15005973AB /* AppDelegate.swift in Sources */,
|
||||||
56A0DC321C85A2C1005973AB /* BasicUIScrollViewController.swift in Sources */,
|
56A0DC321C85A2C1005973AB /* BasicUIScrollViewController.swift in Sources */,
|
||||||
56A0DC0E1C859E30005973AB /* ListViewController.swift in Sources */,
|
56A0DC0E1C859E30005973AB /* ListViewController.swift in Sources */,
|
||||||
|
|
Loading…
Reference in New Issue