Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Popover animator #294

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 116 additions & 3 deletions Demo/Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Demo/Demo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
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>
20 changes: 20 additions & 0 deletions Demo/Demo/AView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// AView.swift
// Demo
//
// Created by Hanguang on 2019/3/13.
// Copyright © 2019 SwiftKick Mobile. All rights reserved.
//

import UIKit
import SwiftMessages

class AView: MessageView {
var position: CGPoint = .zero {
didSet {
var frame = backgroundView.frame
frame.origin = position
backgroundView.frame = frame
}
}
}
42 changes: 42 additions & 0 deletions Demo/Demo/AView.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="AView" customModule="Demo" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="200" height="150"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="N1R-0e-7ta" userLabel="backgroundView" customClass="CornerRoundingView" customModule="SwiftMessages">
<rect key="frame" x="0.0" y="0.0" width="200" height="150"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="N1R-0e-7ta" secondAttribute="trailing" id="Cre-i0-ysc"/>
<constraint firstItem="N1R-0e-7ta" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ZFL-u5-2cI"/>
<constraint firstAttribute="bottom" secondItem="N1R-0e-7ta" secondAttribute="bottom" id="qel-FM-rWP"/>
<constraint firstItem="N1R-0e-7ta" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="zch-If-UcI"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<nil key="simulatedBottomBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="backgroundView" destination="N1R-0e-7ta" id="bNM-09-WZN"/>
</connections>
</view>
</objects>
</document>
49 changes: 36 additions & 13 deletions Demo/Demo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="JQZ-C5-7mw">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="JQZ-C5-7mw">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -220,7 +218,32 @@
<outlet property="delegate" destination="vur-BZ-g1e" id="P2z-vo-Vm2"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Demo" id="2KJ-2Z-WHF"/>
<toolbarItems>
<barButtonItem systemItem="reply" id="voE-tL-PXY">
<connections>
<action selector="showPopover:event:" destination="vur-BZ-g1e" id="EHM-uP-3bh"/>
</connections>
</barButtonItem>
<barButtonItem style="plain" systemItem="flexibleSpace" id="O6V-Nu-8XW"/>
<barButtonItem systemItem="action" id="ccf-6D-xio">
<connections>
<action selector="showPopover:event:" destination="vur-BZ-g1e" id="j4e-Th-dEe"/>
</connections>
</barButtonItem>
</toolbarItems>
<navigationItem key="navigationItem" title="Demo" id="2KJ-2Z-WHF">
<barButtonItem key="leftBarButtonItem" systemItem="done" id="g2r-w7-7te">
<connections>
<action selector="showPopover:event:" destination="vur-BZ-g1e" id="k3T-tp-WIk"/>
</connections>
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="camera" id="hxG-ru-G1V">
<connections>
<action selector="showPopover:event:" destination="vur-BZ-g1e" id="TkF-bq-JcA"/>
</connections>
</barButtonItem>
</navigationItem>
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="L1V-tt-hkn" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
Expand Down Expand Up @@ -833,10 +856,10 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="mGe-El-haJ">
<rect key="frame" x="46" y="104" width="283" height="474"/>
<rect key="frame" x="46" y="104" width="283" height="430"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DrN-Ei-Pg7">
<rect key="frame" x="0.0" y="0.0" width="283" height="59"/>
<rect key="frame" x="0.0" y="0.0" width="283" height="53"/>
<color key="backgroundColor" red="0.16470588235294117" green="0.6588235294117647" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Top Message"/>
Expand All @@ -850,7 +873,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GeC-SP-rSC">
<rect key="frame" x="0.0" y="69" width="283" height="59.5"/>
<rect key="frame" x="0.0" y="63" width="283" height="52.5"/>
<color key="backgroundColor" red="0.1647058824" green="0.6588235294" blue="0.98039215690000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Bottom Message"/>
Expand All @@ -864,7 +887,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DGn-eY-EEX">
<rect key="frame" x="0.0" y="138.5" width="283" height="59"/>
<rect key="frame" x="0.0" y="125.5" width="283" height="53"/>
<color key="backgroundColor" red="0.26627604170000002" green="0.76907009550000005" blue="0.32259114579999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Top Card"/>
Expand All @@ -878,7 +901,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZQs-MK-vK3">
<rect key="frame" x="0.0" y="207.5" width="283" height="59"/>
<rect key="frame" x="0.0" y="188.5" width="283" height="53"/>
<color key="backgroundColor" red="0.26627604170000002" green="0.76907009550000005" blue="0.32259114579999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Bottom Card"/>
Expand All @@ -892,7 +915,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kux-aE-Bdv" userLabel="Top Tab">
<rect key="frame" x="0.0" y="276.5" width="283" height="59"/>
<rect key="frame" x="0.0" y="251.5" width="283" height="53"/>
<color key="backgroundColor" red="0.80000000000000004" green="0.015686274510000067" blue="0.62082127703967116" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Top Tab"/>
Expand All @@ -906,7 +929,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dMQ-xF-RwV" userLabel="Bottom Tab">
<rect key="frame" x="0.0" y="345.5" width="283" height="59.5"/>
<rect key="frame" x="0.0" y="314.5" width="283" height="52.5"/>
<color key="backgroundColor" red="0.80000000000000004" green="0.015686274510000001" blue="0.620821277" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Bottom Tab"/>
Expand All @@ -920,7 +943,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CDi-Gu-bE2" userLabel="Centered">
<rect key="frame" x="0.0" y="415" width="283" height="59"/>
<rect key="frame" x="0.0" y="377" width="283" height="53"/>
<color key="backgroundColor" red="1" green="0.46653546191345963" blue="0.015686274510000042" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<state key="normal" title="Centered"/>
Expand Down
Loading