Skip to content

Commit a6ac9af

Browse files
committed
Add and other box animating vertically (y axis)
1 parent 2932e69 commit a6ac9af

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

iOSAnimationSample/Base.lproj/Main.storyboard

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
<tableViewSection id="5Zl-t8-hX6">
1717
<cells>
1818
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="LkM-fX-yuq" style="IBUITableViewCellStyleDefault" id="f2m-kP-WQN">
19+
<rect key="frame" x="0.0" y="64" width="320" height="44"/>
1920
<autoresizingMask key="autoresizingMask"/>
2021
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="f2m-kP-WQN" id="0Fm-gu-epR">
22+
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
2123
<autoresizingMask key="autoresizingMask"/>
2224
<subviews>
2325
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Position" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="LkM-fX-yuq">
@@ -59,12 +61,18 @@
5961
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
6062
<color key="backgroundColor" red="0.22802925859999998" green="0.66314832058684192" blue="0.70600328947368352" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
6163
</view>
64+
<view contentMode="scaleToFill" id="qDn-u2-IJk">
65+
<rect key="frame" x="130" y="86" width="60" height="60"/>
66+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
67+
<color key="backgroundColor" red="0.96142769610000001" green="0.19560617421842103" blue="0.2744654605526316" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
68+
</view>
6269
</subviews>
6370
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
6471
</view>
6572
<navigationItem key="navigationItem" id="cGh-aI-gZo"/>
6673
<connections>
6774
<outlet property="blueSquare" destination="azk-Fu-KuD" id="GHY-Yf-xjc"/>
75+
<outlet property="redSquare" destination="qDn-u2-IJk" id="VpL-zc-ufr"/>
6876
</connections>
6977
</viewController>
7078
<placeholder placeholderIdentifier="IBFirstResponder" id="DLb-We-4Yt" userLabel="First Responder" sceneMemberID="firstResponder"/>

iOSAnimationSample/PositionViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import UIKit
1010

1111
class PositionViewController: UIViewController {
1212
@IBOutlet weak var blueSquare: UIView!
13+
@IBOutlet weak var redSquare: UIView!
1314

1415
override func viewDidLoad() {
1516
super.viewDidLoad()
@@ -32,6 +33,7 @@ class PositionViewController: UIViewController {
3233

3334
UIView.animateWithDuration(1, animations: {
3435
self.blueSquare.center.x = self.view.bounds.width - self.blueSquare.center.x
36+
self.redSquare.center.y = self.view.bounds.height - self.redSquare.center.y
3537
// <_UIViewAdditiveAnimationAction: 0x7fe17b70df30>
3638
// println(self.view.actionForLayer(self.view.layer, forKey: "position"))
3739
})

0 commit comments

Comments
 (0)