Skip to content

Commit 178970d

Browse files
committed
Add UIView Scale animation
1 parent 3fc04b4 commit 178970d

File tree

3 files changed

+95
-1
lines changed

3 files changed

+95
-1
lines changed

iOSAnimationSample.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
AE337B3C1AF260C0005F4AE1 /* ScaleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */; };
1011
AE8A3A591AF2598200815F4B /* OpacityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8A3A581AF2598200815F4B /* OpacityViewController.swift */; };
1112
AECE40101AEF7274005A5415 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AECE400F1AEF7274005A5415 /* AppDelegate.swift */; };
1213
AECE40121AEF7274005A5415 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AECE40111AEF7274005A5415 /* ViewController.swift */; };
@@ -28,6 +29,7 @@
2829
/* End PBXContainerItemProxy section */
2930

3031
/* Begin PBXFileReference section */
32+
AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScaleViewController.swift; sourceTree = "<group>"; };
3133
AE8A3A581AF2598200815F4B /* OpacityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpacityViewController.swift; sourceTree = "<group>"; };
3234
AECE400A1AEF7274005A5415 /* iOSAnimationSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSAnimationSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
3335
AECE400E1AEF7274005A5415 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -85,10 +87,11 @@
8587
AECE40111AEF7274005A5415 /* ViewController.swift */,
8688
AECE40131AEF7274005A5415 /* Main.storyboard */,
8789
AECE402F1AF03D91005A5415 /* PositionViewController.swift */,
90+
AE8A3A581AF2598200815F4B /* OpacityViewController.swift */,
91+
AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */,
8892
AECE40161AEF7274005A5415 /* Images.xcassets */,
8993
AECE40181AEF7274005A5415 /* LaunchScreen.xib */,
9094
AECE400D1AEF7274005A5415 /* Supporting Files */,
91-
AE8A3A581AF2598200815F4B /* OpacityViewController.swift */,
9295
);
9396
path = iOSAnimationSample;
9497
sourceTree = "<group>";
@@ -219,6 +222,7 @@
219222
buildActionMask = 2147483647;
220223
files = (
221224
AECE40301AF03D91005A5415 /* PositionViewController.swift in Sources */,
225+
AE337B3C1AF260C0005F4AE1 /* ScaleViewController.swift in Sources */,
222226
AECE40121AEF7274005A5415 /* ViewController.swift in Sources */,
223227
AE8A3A591AF2598200815F4B /* OpacityViewController.swift in Sources */,
224228
AECE40101AEF7274005A5415 /* AppDelegate.swift in Sources */,

iOSAnimationSample/Base.lproj/Main.storyboard

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,25 @@
5353
<segue destination="uqT-8N-YiP" kind="push" id="BzM-NV-epb"/>
5454
</connections>
5555
</tableViewCell>
56+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="cCE-B5-QCt" style="IBUITableViewCellStyleDefault" id="6ul-lI-pLs">
57+
<rect key="frame" x="0.0" y="152" width="320" height="44"/>
58+
<autoresizingMask key="autoresizingMask"/>
59+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="6ul-lI-pLs" id="Acl-X3-y9C">
60+
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
61+
<autoresizingMask key="autoresizingMask"/>
62+
<subviews>
63+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Scale" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cCE-B5-QCt">
64+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
65+
<fontDescription key="fontDescription" type="system" pointSize="16"/>
66+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
67+
<nil key="highlightedColor"/>
68+
</label>
69+
</subviews>
70+
</tableViewCellContentView>
71+
<connections>
72+
<segue destination="3Vd-4P-hRd" kind="push" id="pFB-fE-dLT"/>
73+
</connections>
74+
</tableViewCell>
5675
</cells>
5776
</tableViewSection>
5877
</sections>
@@ -152,6 +171,36 @@
152171
</objects>
153172
<point key="canvasLocation" x="109" y="325"/>
154173
</scene>
174+
<!--Scale View Controller-->
175+
<scene sceneID="NLC-B5-45u">
176+
<objects>
177+
<viewController id="3Vd-4P-hRd" customClass="ScaleViewController" customModule="iOSAnimationSample" customModuleProvider="target" sceneMemberID="viewController">
178+
<view key="view" contentMode="scaleToFill" id="1vL-DZ-lLg">
179+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
180+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
181+
<subviews>
182+
<view contentMode="scaleToFill" id="7kW-Cu-9ah">
183+
<rect key="frame" x="100" y="122" width="120" height="120"/>
184+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
185+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
186+
</view>
187+
<view contentMode="scaleToFill" id="wv0-8k-sbn">
188+
<rect key="frame" x="100" y="200" width="120" height="120"/>
189+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
190+
<color key="backgroundColor" red="0.22802925860000001" green="0.66314832059999995" blue="0.70600328950000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
191+
</view>
192+
</subviews>
193+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
194+
</view>
195+
<navigationItem key="navigationItem" id="Aoy-4L-BhP"/>
196+
<connections>
197+
<outlet property="blueSquare" destination="wv0-8k-sbn" id="VIw-jO-ceg"/>
198+
</connections>
199+
</viewController>
200+
<placeholder placeholderIdentifier="IBFirstResponder" id="gCU-ab-NUZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
201+
</objects>
202+
<point key="canvasLocation" x="1052" y="1618"/>
203+
</scene>
155204
</scenes>
156205
<simulatedMetricsContainer key="defaultSimulatedMetrics">
157206
<simulatedStatusBarMetrics key="statusBar"/>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// ScaleViewController.swift
3+
// iOSAnimationSample
4+
//
5+
// Created by Jake Lin on 4/30/15.
6+
// Copyright (c) 2015 JakeLin. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class ScaleViewController: UIViewController {
12+
13+
@IBOutlet weak var blueSquare: UIView!
14+
override func viewDidLoad() {
15+
super.viewDidLoad()
16+
17+
// Do any additional setup after loading the view.
18+
}
19+
20+
override func didReceiveMemoryWarning() {
21+
super.didReceiveMemoryWarning()
22+
// Dispose of any resources that can be recreated.
23+
}
24+
25+
override func viewDidAppear(animated: Bool) {
26+
UIView.animateWithDuration(1, animations: {
27+
self.blueSquare.transform = CGAffineTransformMakeScale(2.0, 2.0)
28+
})
29+
}
30+
31+
/*
32+
// MARK: - Navigation
33+
34+
// In a storyboard-based application, you will often want to do a little preparation before navigation
35+
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
36+
// Get the new view controller using segue.destinationViewController.
37+
// Pass the selected object to the new view controller.
38+
}
39+
*/
40+
41+
}

0 commit comments

Comments
 (0)