Update swift example.
This commit is contained in:
parent
c5b34d468b
commit
d8a9cfcb41
|
|
@ -10,12 +10,14 @@
|
|||
300414221CD751B200453AEB /* FSCalendarScopeHandle.m in Sources */ = {isa = PBXBuildFile; fileRef = 300414211CD751B200453AEB /* FSCalendarScopeHandle.m */; };
|
||||
300414261CD751CF00453AEB /* FSCalendar+Deprecated.m in Sources */ = {isa = PBXBuildFile; fileRef = 300414241CD751CF00453AEB /* FSCalendar+Deprecated.m */; };
|
||||
300BFB121C6446FA00399553 /* FSCalendarEventIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 300BFB111C6446FA00399553 /* FSCalendarEventIndicator.m */; };
|
||||
303478391DB520C8007BBD2E /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 303478381DB520C8007BBD2E /* TableViewController.swift */; };
|
||||
303DE6C11DB1CA3A00F43A0F /* FSCalendarConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 303DE6C01DB1CA3A00F43A0F /* FSCalendarConstants.m */; };
|
||||
3055B1C81DA9338C002AFA13 /* FSCalendarExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3055B1C71DA9338C002AFA13 /* FSCalendarExtensions.m */; };
|
||||
306DB1461C96700800A10478 /* FSCalendarAnimator.m in Sources */ = {isa = PBXBuildFile; fileRef = 306DB1451C96700800A10478 /* FSCalendarAnimator.m */; };
|
||||
3078A8B11C50C0ED003D33EF /* FSCalendarFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = EEC9C03F1BDCA2D600383A07 /* FSCalendarFlowLayout.m */; };
|
||||
30D458E91DB4E2DB00B163C7 /* LoadViewExampleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */; };
|
||||
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AC1B97DDE0007F6964 /* AppDelegate.swift */; };
|
||||
EE0954AF1B97DDE0007F6964 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AE1B97DDE0007F6964 /* ViewController.swift */; };
|
||||
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */; };
|
||||
EE0954B21B97DDE0007F6964 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE0954B01B97DDE0007F6964 /* Main.storyboard */; };
|
||||
EE0954B41B97DDE0007F6964 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE0954B31B97DDE0007F6964 /* Images.xcassets */; };
|
||||
EE0954B71B97DDE0007F6964 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = EE0954B51B97DDE0007F6964 /* LaunchScreen.xib */; };
|
||||
|
|
@ -46,16 +48,18 @@
|
|||
300414241CD751CF00453AEB /* FSCalendar+Deprecated.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FSCalendar+Deprecated.m"; sourceTree = "<group>"; };
|
||||
300BFB101C6446FA00399553 /* FSCalendarEventIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarEventIndicator.h; sourceTree = "<group>"; };
|
||||
300BFB111C6446FA00399553 /* FSCalendarEventIndicator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarEventIndicator.m; sourceTree = "<group>"; };
|
||||
303478381DB520C8007BBD2E /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
|
||||
303DE6BF1DB1CA3A00F43A0F /* FSCalendarConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarConstants.h; sourceTree = "<group>"; };
|
||||
303DE6C01DB1CA3A00F43A0F /* FSCalendarConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarConstants.m; sourceTree = "<group>"; };
|
||||
3055B1C61DA9338C002AFA13 /* FSCalendarExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarExtensions.h; sourceTree = "<group>"; };
|
||||
3055B1C71DA9338C002AFA13 /* FSCalendarExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarExtensions.m; sourceTree = "<group>"; };
|
||||
306DB1441C96700800A10478 /* FSCalendarAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FSCalendarAnimator.h; sourceTree = "<group>"; };
|
||||
306DB1451C96700800A10478 /* FSCalendarAnimator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FSCalendarAnimator.m; sourceTree = "<group>"; };
|
||||
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadViewExampleViewController.swift; sourceTree = "<group>"; };
|
||||
EE0954A71B97DDE0007F6964 /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EE0954AB1B97DDE0007F6964 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
EE0954AC1B97DDE0007F6964 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
EE0954AE1B97DDE0007F6964 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceBuilderViewController.swift; sourceTree = "<group>"; };
|
||||
EE0954B11B97DDE0007F6964 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
EE0954B31B97DDE0007F6964 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
EE0954B61B97DDE0007F6964 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
||||
|
|
@ -124,7 +128,9 @@
|
|||
children = (
|
||||
EE0954CC1B97DDF4007F6964 /* FSCalendar */,
|
||||
EE0954AC1B97DDE0007F6964 /* AppDelegate.swift */,
|
||||
EE0954AE1B97DDE0007F6964 /* ViewController.swift */,
|
||||
303478381DB520C8007BBD2E /* TableViewController.swift */,
|
||||
EE0954AE1B97DDE0007F6964 /* InterfaceBuilderViewController.swift */,
|
||||
30D458E81DB4E2DB00B163C7 /* LoadViewExampleViewController.swift */,
|
||||
EE0954B01B97DDE0007F6964 /* Main.storyboard */,
|
||||
EE0954B31B97DDE0007F6964 /* Images.xcassets */,
|
||||
EE0954B51B97DDE0007F6964 /* LaunchScreen.xib */,
|
||||
|
|
@ -307,14 +313,16 @@
|
|||
EE0954E81B97DDF4007F6964 /* FSCalendarHeader.m in Sources */,
|
||||
EE0954E31B97DDF4007F6964 /* FSCalendar+IBExtension.m in Sources */,
|
||||
300BFB121C6446FA00399553 /* FSCalendarEventIndicator.m in Sources */,
|
||||
303478391DB520C8007BBD2E /* TableViewController.swift in Sources */,
|
||||
EE2B62831BB6D7FE00ACB430 /* FSCalendarStickyHeader.m in Sources */,
|
||||
306DB1461C96700800A10478 /* FSCalendarAnimator.m in Sources */,
|
||||
EE0954E41B97DDF4007F6964 /* FSCalendar.m in Sources */,
|
||||
3055B1C81DA9338C002AFA13 /* FSCalendarExtensions.m in Sources */,
|
||||
3078A8B11C50C0ED003D33EF /* FSCalendarFlowLayout.m in Sources */,
|
||||
30D458E91DB4E2DB00B163C7 /* LoadViewExampleViewController.swift in Sources */,
|
||||
EE0954E51B97DDF4007F6964 /* FSCalendarAppearance.m in Sources */,
|
||||
EE0954AD1B97DDE0007F6964 /* AppDelegate.swift in Sources */,
|
||||
EE0954AF1B97DDE0007F6964 /* ViewController.swift in Sources */,
|
||||
EE0954AF1B97DDE0007F6964 /* InterfaceBuilderViewController.swift in Sources */,
|
||||
300414221CD751B200453AEB /* FSCalendarScopeHandle.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="PJf-VN-VRQ">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="PJf-VN-VRQ">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Navigation Controller-->
|
||||
|
|
@ -14,28 +15,89 @@
|
|||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="lty-fT-aMK" kind="relationship" relationship="rootViewController" id="J2g-dr-uYm"/>
|
||||
<segue destination="pql-xQ-kyz" kind="relationship" relationship="rootViewController" id="HYV-uQ-UNV"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="r7p-cV-Hof" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-769" y="269"/>
|
||||
</scene>
|
||||
<!--FSCalendar-->
|
||||
<scene sceneID="mQI-RU-AqZ">
|
||||
<objects>
|
||||
<tableViewController id="pql-xQ-kyz" customClass="TableViewController" customModule="SwiftExample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="Fzs-qM-cOu">
|
||||
<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="calibratedWhite"/>
|
||||
<sections>
|
||||
<tableViewSection id="rF9-Ar-n8y">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="Drg-hX-Wf1" style="IBUITableViewCellStyleDefault" id="Kfj-Va-Wua">
|
||||
<rect key="frame" x="0.0" y="64" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Kfj-Va-Wua" id="Ovg-vw-USW">
|
||||
<frame key="frameInset" width="375" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Interface Builder" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Drg-hX-Wf1">
|
||||
<frame key="frameInset" minX="15" width="345" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="lty-fT-aMK" kind="show" id="W0j-tq-YZy"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="cWM-iX-3Vc" style="IBUITableViewCellStyleDefault" id="Im4-UX-rci">
|
||||
<rect key="frame" x="0.0" y="108" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Im4-UX-rci" id="82T-qr-tzv">
|
||||
<frame key="frameInset" width="375" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="LoadView" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cWM-iX-3Vc">
|
||||
<frame key="frameInset" minX="15" width="345" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="pql-xQ-kyz" id="MoL-de-DZU"/>
|
||||
<outlet property="delegate" destination="pql-xQ-kyz" id="3Nz-sh-QZl"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="FSCalendar" id="hFo-dn-0Df"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="bb2-XA-uJM" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="52" y="269"/>
|
||||
</scene>
|
||||
<!--Data Source-->
|
||||
<scene sceneID="fuI-jA-1gc">
|
||||
<objects>
|
||||
<viewController id="lty-fT-aMK" customClass="ViewController" customModule="SwiftExample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<viewController id="lty-fT-aMK" customClass="InterfaceBuilderViewController" customModule="SwiftExample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Euq-Om-XUc"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="SlA-5t-TA6"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="kBR-oK-N7Y">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wPJ-CL-JyG" customClass="FSCalendar">
|
||||
<rect key="frame" x="0.0" y="64" width="600" height="300"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="300" id="WIA-b7-boT"/>
|
||||
</constraints>
|
||||
|
|
@ -48,7 +110,7 @@
|
|||
</connections>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="backgroundColor" red="0.94117647058823528" green="0.94117647058823528" blue="0.94117647058823528" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="wPJ-CL-JyG" secondAttribute="trailing" id="002-Gr-M9c"/>
|
||||
<constraint firstItem="wPJ-CL-JyG" firstAttribute="top" secondItem="Euq-Om-XUc" secondAttribute="bottom" id="MGn-0L-7MJ"/>
|
||||
|
|
@ -63,7 +125,7 @@
|
|||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="o4Q-iq-LTl" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-77" y="269"/>
|
||||
<point key="canvasLocation" x="958" y="-52"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController, FSCalendarDataSource, FSCalendarDelegate {
|
||||
class InterfaceBuilderViewController: UIViewController, FSCalendarDataSource, FSCalendarDelegate {
|
||||
|
||||
@IBOutlet weak var calendar: FSCalendar!
|
||||
@IBOutlet weak var calendarHeightConstraint: NSLayoutConstraint!
|
||||
|
|
@ -43,7 +43,6 @@ class ViewController: UIViewController, FSCalendarDataSource, FSCalendarDelegate
|
|||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
func minimumDate(for calendar: FSCalendar) -> Date {
|
||||
return self.formatter.date(from: "2015/01/01")!
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// LoadViewExampleViewController.swift
|
||||
// SwiftExample
|
||||
//
|
||||
// Created by dingwenchao on 10/17/16.
|
||||
// Copyright © 2016 wenchao. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class LoadViewExampleViewController: UIViewController, FSCalendarDataSource, FSCalendarDelegate {
|
||||
|
||||
private weak var calendar: FSCalendar!
|
||||
|
||||
override func loadView() {
|
||||
|
||||
let view = UIView(frame: UIScreen.main.bounds)
|
||||
view.backgroundColor = UIColor.groupTableViewBackground
|
||||
self.view = view
|
||||
|
||||
let calendar = FSCalendar(frame: CGRect(x: 0, y: self.navigationController!.navigationBar.frame.maxY, width: self.view.bounds.width, height: 300))
|
||||
calendar.dataSource = self
|
||||
calendar.delegate = self
|
||||
calendar.backgroundColor = UIColor.white
|
||||
calendar.scopeGesture.isEnabled = true
|
||||
self.view.addSubview(calendar)
|
||||
self.calendar = calendar
|
||||
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
self.title = "FSCalendar"
|
||||
}
|
||||
|
||||
// Update your frame
|
||||
func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
|
||||
calendar.frame = CGRect(x: 0, y: self.navigationController!.navigationBar.frame.maxY, width: bounds.width, height: bounds.height)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
//
|
||||
// TableViewController.swift
|
||||
// SwiftExample
|
||||
//
|
||||
// Created by dingwenchao on 10/17/16.
|
||||
// Copyright © 2016 wenchao. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class TableViewController: UITableViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
// super.tableView(tableView, didSelectRowAt: indexPath)
|
||||
if indexPath.row == 1 {
|
||||
let viewController = LoadViewExampleViewController()
|
||||
self.navigationController?.pushViewController(viewController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue