Skip to content

Commit

Permalink
Day 16 - 自定义转场动画
Browse files Browse the repository at this point in the history
1.升级到swift4
2.将动画修改为侧边栏的效果
  • Loading branch information
qianyb committed Dec 25, 2018
1 parent b925cb6 commit 1e84965
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 151 deletions.
11 changes: 11 additions & 0 deletions Project 16 - SlideMenu/SlideMenu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
14FFEF0321D229BF00B63D77 /* BaseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14FFEF0221D229BF00B63D77 /* BaseTableViewController.swift */; };
9F2598041C51EA6F007B64C4 /* MenuTransitionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2598031C51EA6F007B64C4 /* MenuTransitionManager.swift */; };
9F2598061C521FFE007B64C4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2598051C521FFE007B64C4 /* LaunchScreen.storyboard */; };
F456196C1A8871DA00836A98 /* MenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F456196B1A8871DA00836A98 /* MenuTableViewController.swift */; };
Expand All @@ -30,6 +31,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
14FFEF0221D229BF00B63D77 /* BaseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTableViewController.swift; sourceTree = "<group>"; };
9F2598031C51EA6F007B64C4 /* MenuTransitionManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuTransitionManager.swift; sourceTree = "<group>"; };
9F2598051C521FFE007B64C4 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
F456196B1A8871DA00836A98 /* MenuTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuTableViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -91,6 +93,7 @@
F4C1CF291A85B99500728CAD /* NewsTableViewCell.swift */,
F456196B1A8871DA00836A98 /* MenuTableViewController.swift */,
F456196D1A8872A800836A98 /* MenuTableViewCell.swift */,
14FFEF0221D229BF00B63D77 /* BaseTableViewController.swift */,
F4C1CF0B1A84F64E00728CAD /* Main.storyboard */,
F4C1CF0E1A84F64E00728CAD /* Images.xcassets */,
9F2598051C521FFE007B64C4 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -166,6 +169,7 @@
TargetAttributes = {
F4C1CF011A84F64E00728CAD = {
CreatedOnToolsVersion = 6.1.1;
DevelopmentTeam = F3YT8BWBYJ;
};
F4C1CF161A84F64E00728CAD = {
CreatedOnToolsVersion = 6.1.1;
Expand Down Expand Up @@ -220,6 +224,7 @@
F4C1CF281A85B3C600728CAD /* NewsTableViewController.swift in Sources */,
9F2598041C51EA6F007B64C4 /* MenuTransitionManager.swift in Sources */,
F456196E1A8872A800836A98 /* MenuTableViewCell.swift in Sources */,
14FFEF0321D229BF00B63D77 /* BaseTableViewController.swift in Sources */,
F456196C1A8871DA00836A98 /* MenuTableViewController.swift in Sources */,
F4C1CF081A84F64E00728CAD /* AppDelegate.swift in Sources */,
F4C1CF2A1A85B99500728CAD /* NewsTableViewCell.swift in Sources */,
Expand Down Expand Up @@ -338,21 +343,27 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = F3YT8BWBYJ;
INFOPLIST_FILE = SlideMenu/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.appcoda.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
F4C1CF231A84F64E00728CAD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = F3YT8BWBYJ;
INFOPLIST_FILE = SlideMenu/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.appcoda.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
58 changes: 31 additions & 27 deletions Project 16 - SlideMenu/SlideMenu/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,45 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15E33e" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="qJo-DB-YKl">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="qJo-DB-YKl">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Menu Table View Controller-->
<scene sceneID="GBt-Do-NSV">
<objects>
<tableViewController id="pUA-9M-XjT" customClass="MenuTableViewController" customModule="SlideMenu" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="HBB-dI-kDA">
<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"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<view key="tableHeaderView" contentMode="scaleToFill" id="Hcm-0e-DQK">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" rowHeight="50" id="NWX-79-4hg" customClass="MenuTableViewCell" customModule="SlideMenu" customModuleProvider="target">
<rect key="frame" x="0.0" y="66" width="600" height="50"/>
<rect key="frame" x="0.0" y="66" width="375" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="NWX-79-4hg" id="bdJ-qR-Cg0">
<rect key="frame" x="0.0" y="0.0" width="600" height="50"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Home" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tgz-zH-LXd">
<rect key="frame" x="17" y="10" width="61.5" height="30.5"/>
<rect key="frame" x="25" y="10" width="61.5" height="30.5"/>
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="22"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="tgz-zH-LXd" secondAttribute="trailing" constant="20" symbolic="YES" id="7yK-U3-J4w"/>
<constraint firstItem="tgz-zH-LXd" firstAttribute="leading" secondItem="bdJ-qR-Cg0" secondAttribute="leadingMargin" constant="9" id="JgR-xd-Pa4"/>
<constraint firstAttribute="centerY" secondItem="tgz-zH-LXd" secondAttribute="centerY" id="tWT-O9-Abq"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" red="0.10895504802465439" green="0.11458001285791397" blue="0.12908875942230225" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.08362840861082077" green="0.087108030915260315" blue="0.097468264400959015" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<outlet property="titleLabel" destination="tgz-zH-LXd" id="DiK-jP-TYG"/>
<segue destination="COF-N4-X5g" kind="unwind" unwindAction="unwindToHome:" id="xv1-JU-8Zc"/>
Expand All @@ -63,39 +67,39 @@
<objects>
<tableViewController id="riJ-2Y-oP1" customClass="NewsTableViewController" customModule="SlideMenu" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="250" sectionHeaderHeight="22" sectionFooterHeight="22" id="t75-cX-jaD">
<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"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes>
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="Cell" rowHeight="241" id="326-jL-bcm" customClass="NewsTableViewCell" customModule="SlideMenu" customModuleProvider="target">
<rect key="frame" x="0.0" y="86" width="600" height="241"/>
<rect key="frame" x="0.0" y="22" width="375" height="241"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="326-jL-bcm" id="8Vn-IX-WNt">
<rect key="frame" x="0.0" y="0.0" width="600" height="240.5"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="240.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="HFM-nA-7bo">
<rect key="frame" x="0.0" y="0.0" width="600" height="240"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="237.5"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="n6B-hb-e40">
<rect key="frame" x="0.0" y="0.0" width="600" height="240"/>
<color key="backgroundColor" white="0.0" alpha="0.20000000000000001" colorSpace="calibratedWhite"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="237.5"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tmP-hj-as4">
<rect key="frame" x="16" y="185" width="40" height="40"/>
<rect key="frame" x="24" y="182.5" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="VGz-ER-tn7"/>
<constraint firstAttribute="height" constant="40" id="tBz-7c-lIT"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4cc-Tn-mxx">
<rect key="frame" x="64" y="182" width="517" height="27"/>
<rect key="frame" x="72" y="179.5" width="276" height="27"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="aRH-wY-Yql"/>
<constraint firstAttribute="height" constant="27" id="bne-jO-fDI"/>
</constraints>
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="16"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
Expand All @@ -104,13 +108,13 @@
</variation>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OPc-Ie-6hD">
<rect key="frame" x="64" y="206" width="517" height="21"/>
<rect key="frame" x="72" y="203.5" width="276" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="KKd-71-rNo"/>
<constraint firstAttribute="height" constant="21" id="nVP-yD-51e"/>
</constraints>
<fontDescription key="fontDescription" name="AvenirNext-Regular" family="Avenir Next" pointSize="14"/>
<color key="textColor" red="0.99989169836044312" green="1" blue="0.99988096952438354" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<color key="textColor" red="0.99987119436264038" green="0.99998223781585693" blue="0.99984109401702881" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
<variation key="default">
<mask key="constraints">
Expand Down Expand Up @@ -178,7 +182,7 @@
</tableView>
<navigationItem key="navigationItem" title="News" id="Q9t-hJ-dpA">
<barButtonItem key="leftBarButtonItem" title="🍔" id="gZS-0Q-dOU">
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<segue destination="pUA-9M-XjT" kind="presentation" id="ty4-DU-bJY"/>
</connections>
Expand All @@ -195,7 +199,7 @@
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="qJo-DB-YKl" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" barStyle="blackTranslucent" id="t3c-YL-R3F">
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
Expand Down
22 changes: 22 additions & 0 deletions Project 16 - SlideMenu/SlideMenu/BaseTableViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// BaseTableViewController.swift
// SlideMenu
//
// Created by qianyb on 2018/12/25.
// Copyright © 2018 AppCoda. All rights reserved.
//

import Foundation
import UIKit

class BaseTableViewController: UITableViewController {

override var preferredStatusBarStyle: UIStatusBarStyle {
return UIStatusBarStyle.lightContent
}

override func viewDidLoad() {
super.viewDidLoad()
self.tableView.separatorStyle = UITableViewCellSeparatorStyle.none
}
}
Loading

0 comments on commit 1e84965

Please sign in to comment.