Skip to content

Commit 6a13412

Browse files
committed
Add UIView Color animation
1 parent 178970d commit 6a13412

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed

iOSAnimationSample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
AE337B3C1AF260C0005F4AE1 /* ScaleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */; };
11+
AE337B3E1AF26525005F4AE1 /* ColorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE337B3D1AF26525005F4AE1 /* ColorViewController.swift */; };
1112
AE8A3A591AF2598200815F4B /* OpacityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8A3A581AF2598200815F4B /* OpacityViewController.swift */; };
1213
AECE40101AEF7274005A5415 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AECE400F1AEF7274005A5415 /* AppDelegate.swift */; };
1314
AECE40121AEF7274005A5415 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AECE40111AEF7274005A5415 /* ViewController.swift */; };
@@ -30,6 +31,7 @@
3031

3132
/* Begin PBXFileReference section */
3233
AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScaleViewController.swift; sourceTree = "<group>"; };
34+
AE337B3D1AF26525005F4AE1 /* ColorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorViewController.swift; sourceTree = "<group>"; };
3335
AE8A3A581AF2598200815F4B /* OpacityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OpacityViewController.swift; sourceTree = "<group>"; };
3436
AECE400A1AEF7274005A5415 /* iOSAnimationSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSAnimationSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
3537
AECE400E1AEF7274005A5415 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -89,6 +91,7 @@
8991
AECE402F1AF03D91005A5415 /* PositionViewController.swift */,
9092
AE8A3A581AF2598200815F4B /* OpacityViewController.swift */,
9193
AE337B3B1AF260C0005F4AE1 /* ScaleViewController.swift */,
94+
AE337B3D1AF26525005F4AE1 /* ColorViewController.swift */,
9295
AECE40161AEF7274005A5415 /* Images.xcassets */,
9396
AECE40181AEF7274005A5415 /* LaunchScreen.xib */,
9497
AECE400D1AEF7274005A5415 /* Supporting Files */,
@@ -225,6 +228,7 @@
225228
AE337B3C1AF260C0005F4AE1 /* ScaleViewController.swift in Sources */,
226229
AECE40121AEF7274005A5415 /* ViewController.swift in Sources */,
227230
AE8A3A591AF2598200815F4B /* OpacityViewController.swift in Sources */,
231+
AE337B3E1AF26525005F4AE1 /* ColorViewController.swift in Sources */,
228232
AECE40101AEF7274005A5415 /* AppDelegate.swift in Sources */,
229233
);
230234
runOnlyForDeploymentPostprocessing = 0;

iOSAnimationSample/Base.lproj/Main.storyboard

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@
7272
<segue destination="3Vd-4P-hRd" kind="push" id="pFB-fE-dLT"/>
7373
</connections>
7474
</tableViewCell>
75+
<tableViewCell contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" textLabel="9v2-62-grt" style="IBUITableViewCellStyleDefault" id="KSN-gh-s6L">
76+
<rect key="frame" x="0.0" y="196" width="320" height="44"/>
77+
<autoresizingMask key="autoresizingMask"/>
78+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KSN-gh-s6L" id="ek7-de-c2O">
79+
<rect key="frame" x="0.0" y="0.0" width="287" height="43"/>
80+
<autoresizingMask key="autoresizingMask"/>
81+
<subviews>
82+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Color" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9v2-62-grt">
83+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
84+
<fontDescription key="fontDescription" type="system" pointSize="16"/>
85+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
86+
<nil key="highlightedColor"/>
87+
</label>
88+
</subviews>
89+
</tableViewCellContentView>
90+
<connections>
91+
<segue destination="UBL-bn-Me0" kind="push" id="EVz-2G-zhx"/>
92+
</connections>
93+
</tableViewCell>
7594
</cells>
7695
</tableViewSection>
7796
</sections>
@@ -201,6 +220,31 @@
201220
</objects>
202221
<point key="canvasLocation" x="1052" y="1618"/>
203222
</scene>
223+
<!--Color View Controller-->
224+
<scene sceneID="FO5-vp-aVZ">
225+
<objects>
226+
<viewController id="UBL-bn-Me0" customClass="ColorViewController" customModule="iOSAnimationSample" customModuleProvider="target" sceneMemberID="viewController">
227+
<view key="view" contentMode="scaleToFill" id="eFn-Sb-cUk">
228+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
229+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
230+
<subviews>
231+
<view contentMode="scaleToFill" id="jSK-28-Rd5">
232+
<rect key="frame" x="100" y="100" width="120" height="120"/>
233+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
234+
<color key="backgroundColor" red="0.22802925860000001" green="0.66314832059999995" blue="0.70600328950000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
235+
</view>
236+
</subviews>
237+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
238+
</view>
239+
<navigationItem key="navigationItem" id="0YD-4W-ey7"/>
240+
<connections>
241+
<outlet property="blueSquare" destination="jSK-28-Rd5" id="5RP-ua-dhj"/>
242+
</connections>
243+
</viewController>
244+
<placeholder placeholderIdentifier="IBFirstResponder" id="PZN-Mt-Bh8" userLabel="First Responder" sceneMemberID="firstResponder"/>
245+
</objects>
246+
<point key="canvasLocation" x="1052" y="2269"/>
247+
</scene>
204248
</scenes>
205249
<simulatedMetricsContainer key="defaultSimulatedMetrics">
206250
<simulatedStatusBarMetrics key="statusBar"/>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// ColorViewController.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 ColorViewController: 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.backgroundColor = UIColor.redColor()
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)