Detect orientation in App Extension

Fix #162
This commit is contained in:
dingwenchao 2015-12-20 15:53:13 +08:00
parent 8dad8793c6
commit 661f376fa5
3 changed files with 55 additions and 131 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="x1V-gv-tFA">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="x1V-gv-tFA">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
@ -12,7 +12,6 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="yhE-pm-rYs">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<color key="tintColor" red="0.22352941179999999" green="0.27450980390000002" blue="0.34901960780000002" alpha="1" colorSpace="calibratedRGB"/>
</navigationBar>
<connections>
@ -30,7 +29,6 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="lkh-E0-tT6">
<rect key="frame" x="0.0" y="0.0" width="600" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<sections>
<tableViewSection id="OKx-qF-6aM">
@ -45,7 +43,6 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Calendar Identifier" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Vs7-Jd-cjq">
<rect key="frame" x="15" y="12" width="133.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -53,15 +50,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Feature!" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="gff-XM-V55">
<rect key="frame" x="525" y="12" width="60" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="1MA-EI-d9Y" detailTextLabel="Fd2-ZY-i4q" style="IBUITableViewCellStyleValue1" id="20K-34-abb">
<rect key="frame" x="0.0" y="108" width="600" height="44"/>
@ -73,7 +67,6 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Delegate Appearance" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1MA-EI-d9Y">
<rect key="frame" x="15" y="12" width="157" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -81,15 +74,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="Fd2-ZY-i4q">
<rect key="frame" x="543.5" y="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="1" green="0.5" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="LZ9-Fp-P5z" detailTextLabel="59s-j4-9Zz" style="IBUITableViewCellStyleValue1" id="TLw-G1-xh8">
<rect key="frame" x="0.0" y="152" width="600" height="44"/>
@ -101,7 +91,6 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Full Screen Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="LZ9-Fp-P5z">
<rect key="frame" x="15" y="12" width="146" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -109,15 +98,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="59s-j4-9Zz">
<rect key="frame" x="543.5" y="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.87450980389999999" green="0.21960784310000001" blue="0.24313725489999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="vsl-87-uJv" detailTextLabel="HDn-MC-Z72" style="IBUITableViewCellStyleValue1" id="9BE-p1-W4Y">
<rect key="frame" x="0.0" y="196" width="600" height="44"/>
@ -129,7 +115,6 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Multiple Selection Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vsl-87-uJv">
<rect key="frame" x="15" y="12" width="195" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -137,15 +122,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HDn-MC-Z72">
<rect key="frame" x="543.5" y="12" width="41.5" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="sRI-B1-vbS" style="IBUITableViewCellStyleDefault" id="hX9-bB-aHp">
<rect key="frame" x="0.0" y="240" width="600" height="44"/>
@ -157,15 +139,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="FSCalendarScope Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="sRI-B1-vbS">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
<connections>
<segue destination="To9-yq-KZP" kind="show" id="Evz-Bc-bgS"/>
</connections>
@ -180,15 +159,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Storyboard Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="4Jp-Rp-ISm">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
<connections>
<segue destination="vXZ-lx-hvc" kind="show" id="3DX-18-9y4"/>
</connections>
@ -203,15 +179,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="LoadView Example" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="A43-g1-NbJ">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="fKN-25-6hl" detailTextLabel="vj2-67-hOL" style="IBUITableViewCellStyleValue1" id="9cT-ls-dQa">
<rect key="frame" x="0.0" y="372" width="600" height="44"/>
@ -223,7 +196,6 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="ViewDidLoad Example" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="fKN-25-6hl">
<rect key="frame" x="15" y="12" width="161" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
@ -231,15 +203,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Deprecated" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="vj2-67-hOL">
<rect key="frame" x="500" y="12" width="85" height="19.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>
@ -271,7 +240,6 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7hZ-tJ-5NZ" customClass="FSCalendar">
<rect key="frame" x="0.0" y="64" width="600" height="300"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="cDz-g5-tqF"/>
@ -289,7 +257,6 @@
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="noP-KN-SwP">
<rect key="frame" x="0.0" y="365" width="600" height="435"/>
<animations/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="435" id="B9d-rT-Wom"/>
@ -300,17 +267,14 @@
<subviews>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2pf-mw-cB2">
<rect key="frame" x="104" y="4" width="51" height="31"/>
<animations/>
</switch>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Animated" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hcJ-ta-ZTH">
<rect key="frame" x="14" y="9" width="73" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
<prototypes>
@ -324,15 +288,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="FSCalendarScopeMonth" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="qol-Mc-4nA">
<rect key="frame" x="15" y="0.0" width="546" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell_week" textLabel="IbE-ao-K9G" style="IBUITableViewCellStyleDefault" id="Hqm-gV-y6n">
<rect key="frame" x="0.0" y="93.5" width="600" height="44"/>
@ -344,15 +305,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="FSCalendarScopeWeek" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IbE-ao-K9G">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</prototypes>
<connections>
@ -361,7 +319,6 @@
</connections>
</tableView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="7hZ-tJ-5NZ" secondAttribute="trailing" id="5En-7U-m9P"/>
@ -404,7 +361,6 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="i44-Ll-ELi" customClass="FSCalendar">
<rect key="frame" x="0.0" y="64" width="600" height="300"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="300" id="AsQ-eP-ia8"/>
@ -425,7 +381,6 @@
</connections>
</view>
</subviews>
<animations/>
<color key="backgroundColor" red="0.90980392160000001" green="0.91372549020000005" blue="0.90980392160000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="i44-Ll-ELi" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="1gL-Jb-oDc"/>
@ -457,7 +412,6 @@
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="jT2-lU-gLR">
<rect key="frame" x="0.0" y="0.0" width="600" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.95686274509803926" alpha="1" colorSpace="calibratedRGB"/>
<sections>
<tableViewSection headerTitle="Theme" id="lLy-fn-2TE">
@ -472,15 +426,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Theme1" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="O62-83-teD">
<rect key="frame" x="15" y="0.0" width="546" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="h3n-ib-wIe" style="IBUITableViewCellStyleDefault" id="blV-7a-bgu">
<rect key="frame" x="0.0" y="157.5" width="600" height="44"/>
@ -492,15 +443,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Theme2" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="h3n-ib-wIe">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="6sG-w2-epw" style="IBUITableViewCellStyleDefault" id="Sgh-je-y0P">
<rect key="frame" x="0.0" y="201.5" width="600" height="44"/>
@ -512,15 +460,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Theme3" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="6sG-w2-epw">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>
@ -536,15 +481,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Lunar" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cll-gl-Oyc">
<rect key="frame" x="15" y="0.0" width="546" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>
@ -560,15 +502,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Horizontal" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="l29-05-Mps">
<rect key="frame" x="15" y="0.0" width="546" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="wSk-45-sYI" style="IBUITableViewCellStyleDefault" id="jrr-g8-vMH">
<rect key="frame" x="0.0" y="417.5" width="600" height="44"/>
@ -580,15 +519,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Vertical" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="wSk-45-sYI">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>
@ -603,7 +539,6 @@
<subviews>
<datePicker contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" datePickerMode="date" minuteInterval="1" translatesAutoresizingMaskIntoConstraints="NO" id="9jN-O2-iw4">
<rect key="frame" x="0.0" y="0.0" width="600" height="162"/>
<animations/>
<date key="date" timeIntervalSinceReferenceDate="448248004.37374699">
<!--2015-03-17 01:20:04 +0000-->
</date>
@ -615,7 +550,6 @@
</date>
</datePicker>
</subviews>
<animations/>
<constraints>
<constraint firstAttribute="bottom" secondItem="9jN-O2-iw4" secondAttribute="bottom" id="7bs-so-tMY"/>
<constraint firstItem="9jN-O2-iw4" firstAttribute="leading" secondItem="IPe-2o-5Tt" secondAttribute="leading" id="TdV-lD-3Kk"/>
@ -623,7 +557,6 @@
<constraint firstAttribute="trailing" secondItem="9jN-O2-iw4" secondAttribute="trailing" id="nYy-kg-X1b"/>
</constraints>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="bo0-pq-yfc" style="IBUITableViewCellStyleDefault" id="XkD-qX-hNP">
<rect key="frame" x="0.0" y="666.5" width="600" height="44"/>
@ -635,15 +568,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Click to select" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bo0-pq-yfc">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>
@ -659,15 +589,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Sunday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="b1w-3T-SyL">
<rect key="frame" x="15" y="0.0" width="546" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="1mu-CL-5W8" style="IBUITableViewCellStyleDefault" id="7J8-y8-jhG">
<rect key="frame" x="0.0" y="796.5" width="600" height="44"/>
@ -679,15 +606,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Monday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1mu-CL-5W8">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="1TT-Ea-cLc" style="IBUITableViewCellStyleDefault" id="a9F-Qo-P7t">
<rect key="frame" x="0.0" y="840.5" width="600" height="44"/>
@ -699,15 +623,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Tuesday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="1TT-Ea-cLc">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="8Rm-Lk-xrc" style="IBUITableViewCellStyleDefault" id="SSQ-E0-iHW">
<rect key="frame" x="0.0" y="884.5" width="600" height="44"/>
@ -719,15 +640,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Wednesday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="8Rm-Lk-xrc">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="bfC-Bz-4vz" style="IBUITableViewCellStyleDefault" id="e4I-Uv-pGe">
<rect key="frame" x="0.0" y="928.5" width="600" height="44"/>
@ -739,15 +657,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Thursday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bfC-Bz-4vz">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="EaK-NQ-DfA" style="IBUITableViewCellStyleDefault" id="NEU-aY-ej6">
<rect key="frame" x="0.0" y="972.5" width="600" height="44"/>
@ -759,15 +674,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Friday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="EaK-NQ-DfA">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" textLabel="jZz-sF-yrb" style="IBUITableViewCellStyleDefault" id="vUs-68-LZs">
<rect key="frame" x="0.0" y="1016.5" width="600" height="44"/>
@ -779,15 +691,12 @@
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Saturday" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="jZz-sF-yrb">
<rect key="frame" x="15" y="0.0" width="570" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
</tableViewCellContentView>
<animations/>
</tableViewCell>
</cells>
</tableViewSection>

View File

@ -17,6 +17,11 @@
#import "FSCalendarDynamicHeader.h"
#import "FSCalendarCollectionView.h"
typedef NS_ENUM(NSUInteger, FSCalendarOrientation) {
FSCalendarOrientationLandscape,
FSCalendarOrientationPortrait
};
@interface FSCalendar (DataSourceAndDelegate)
- (BOOL)hasEventForDate:(NSDate *)date;
@ -77,11 +82,12 @@
@property (assign, nonatomic) CGFloat preferedHeaderHeight;
@property (assign, nonatomic) CGFloat preferedWeekdayHeight;
@property (assign, nonatomic) CGFloat preferedRowHeight;
@property (assign, nonatomic) UIInterfaceOrientation interfaceOrientation;
@property (assign, nonatomic) FSCalendarOrientation orientation;
@property (readonly, nonatomic) BOOL floatingMode;
@property (readonly, nonatomic) BOOL hasValidateVisibleLayout;
@property (readonly, nonatomic) NSArray *visibleStickyHeaders;
@property (readonly, nonatomic) FSCalendarOrientation currentCalendarOrientation;
@property (readonly, nonatomic) id<FSCalendarDelegateAppearance> delegateAppearance;
@ -182,7 +188,7 @@
_needsAdjustingTextSize = YES;
_needsAdjustingMonthPosition = YES;
_stickyHeaderMapTable = [NSMapTable weakToWeakObjectsMapTable];
_interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
_orientation = self.currentCalendarOrientation;
UIView *contentView = [[UIView alloc] initWithFrame:CGRectZero];
contentView.backgroundColor = [UIColor clearColor];
@ -274,7 +280,7 @@
weekdayWidth,
weekdayHeight);
}];
_deliver.frame = CGRectMake(_header.fs_left, _header.fs_top, _header.fs_width, headerHeight+weekdayHeight);
_deliver.hidden = _header.hidden;
@ -668,7 +674,7 @@
- (void)orientationDidChange:(NSNotification *)notification
{
self.interfaceOrientation = [UIApplication sharedApplication].statusBarOrientation;
self.orientation = self.currentCalendarOrientation;
}
- (void)significantTimeDidChange:(NSNotification *)notification
@ -890,24 +896,22 @@
}
}
- (void)setInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- (void)setOrientation:(FSCalendarOrientation)orientation
{
if (_interfaceOrientation != interfaceOrientation) {
_interfaceOrientation = interfaceOrientation;
if (_orientation != orientation) {
_orientation = orientation;
_needsAdjustingViewFrame = YES;
_needsAdjustingMonthPosition = YES;
_needsAdjustingTextSize = YES;
_preferedWeekdayHeight = FSCalendarAutomaticDimension;
_preferedRowHeight = FSCalendarAutomaticDimension;
_preferedHeaderHeight = FSCalendarAutomaticDimension;
[self.visibleStickyHeaders setValue:@YES forKey:@"needsAdjustingViewFrame"];
[_collectionView.visibleCells setValue:@YES forKey:@"needsAdjustingViewFrame"];
_header.needsAdjustingViewFrame = YES;
[self setNeedsLayout];
if (interfaceOrientation != UIInterfaceOrientationUnknown) {
_needsAdjustingViewFrame = YES;
_needsAdjustingMonthPosition = YES;
_needsAdjustingTextSize = YES;
_preferedWeekdayHeight = FSCalendarAutomaticDimension;
_preferedRowHeight = FSCalendarAutomaticDimension;
_preferedHeaderHeight = FSCalendarAutomaticDimension;
[self.visibleStickyHeaders setValue:@YES forKey:@"needsAdjustingViewFrame"];
[_collectionView.visibleCells setValue:@YES forKey:@"needsAdjustingViewFrame"];
_header.needsAdjustingViewFrame = YES;
[self setNeedsLayout];
}
}
}
@ -1345,7 +1349,6 @@
} else {
//
if (self.hasValidateVisibleLayout) {
// [_collectionViewLayout invalidateLayout];
CGRect headerFrame = [_collectionViewLayout layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:scrollOffset]].frame;
CGPoint targetOffset = CGPointMake(0, MIN(headerFrame.origin.y,_collectionView.contentSize.height-_collectionView.fs_bottom));
[_collectionView setContentOffset:targetOffset animated:animated];
@ -1738,6 +1741,17 @@
[_weekdays makeObjectsPerformSelector:@selector(setTextColor:) withObject:_appearance.weekdayTextColor];
}
// The best way to detect orientation
// http://stackoverflow.com/questions/25830448/what-is-the-best-way-to-detect-orientation-in-an-app-extension/26023538#26023538
- (FSCalendarOrientation)currentCalendarOrientation
{
CGFloat scale = [UIScreen mainScreen].scale;
CGSize nativeSize = [UIScreen mainScreen].currentMode.size;
CGSize sizeInPoints = [UIScreen mainScreen].bounds.size;
FSCalendarOrientation orientation = scale * sizeInPoints.width == nativeSize.width ? FSCalendarOrientationPortrait : FSCalendarOrientationLandscape;
return orientation;
}
#pragma mark - Delegate
- (BOOL)shouldSelectDate:(NSDate *)date

View File

@ -66,23 +66,24 @@
[super layoutSubviews];
if (_needsAdjustingViewFrame) {
if (!CGSizeEqualToSize(self.frame.size, CGSizeZero)) {
_needsAdjustingViewFrame = NO;
_contentView.frame = self.bounds;
CGFloat weekdayWidth = self.fs_width / 7.0;
CGFloat weekdayHeight = _calendar.preferedWeekdayHeight;
CGFloat weekdayMargin = weekdayHeight * 0.1;
CGFloat titleWidth = _contentView.fs_width;
[_weekdayLabels enumerateObjectsUsingBlock:^(UILabel *label, NSUInteger index, BOOL *stop) { \
label.frame = CGRectMake(index*weekdayWidth, _contentView.fs_height-weekdayHeight-weekdayMargin, weekdayWidth, weekdayHeight);
}];
CGFloat titleHeight = [@"1" sizeWithAttributes:@{NSFontAttributeName:_appearance.preferredHeaderTitleFont}].height*1.5 + weekdayMargin*3;
_separator.frame = CGRectMake(0, _contentView.fs_height-weekdayHeight-weekdayMargin*2, _contentView.fs_width, 1.0);
_titleLabel.frame = CGRectMake(0, _separator.fs_bottom-titleHeight-weekdayMargin, titleWidth,titleHeight);
}
_needsAdjustingViewFrame = NO;
_contentView.frame = self.bounds;
CGFloat weekdayWidth = self.fs_width / 7.0;
CGFloat weekdayHeight = _calendar.preferedWeekdayHeight;
CGFloat weekdayMargin = weekdayHeight * 0.1;
CGFloat titleWidth = _contentView.fs_width;
[_weekdayLabels enumerateObjectsUsingBlock:^(UILabel *label, NSUInteger index, BOOL *stop) { \
label.frame = CGRectMake(index*weekdayWidth, _contentView.fs_height-weekdayHeight-weekdayMargin, weekdayWidth, weekdayHeight);
}];
CGFloat titleHeight = [@"1" sizeWithAttributes:@{NSFontAttributeName:_appearance.preferredHeaderTitleFont}].height*1.5 + weekdayMargin*3;
_separator.frame = CGRectMake(0, _contentView.fs_height-weekdayHeight-weekdayMargin*2, _contentView.fs_width, 1.0);
_titleLabel.frame = CGRectMake(0, _separator.fs_bottom-titleHeight-weekdayMargin, titleWidth,titleHeight);
}
[self reloadData];