Skip to content

Commit a521995

Browse files
committed
Swifty animations
1 parent 4b68ff2 commit a521995

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

TestSwift.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
021E1AEF1944CDDE00FDC37C /* Track.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021E1AEE1944CDDE00FDC37C /* Track.swift */; };
1111
021E1AF11944D4A800FDC37C /* TrackCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021E1AF01944D4A800FDC37C /* TrackCell.swift */; };
12+
021E1AF31944E0C200FDC37C /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 021E1AF21944E0C200FDC37C /* QuartzCore.framework */; };
1213
022889EF193FC3AC00D729A0 /* DetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022889EE193FC3AC00D729A0 /* DetailsViewController.swift */; };
1314
022889F1193FD6C000D729A0 /* Album.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022889F0193FD6C000D729A0 /* Album.swift */; };
1415
0229AE63193F97EF00BCED97 /* Blank52.png in Resources */ = {isa = PBXBuildFile; fileRef = 0229AE62193F97EF00BCED97 /* Blank52.png */; };
@@ -33,6 +34,7 @@
3334
/* Begin PBXFileReference section */
3435
021E1AEE1944CDDE00FDC37C /* Track.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Track.swift; path = Classes/Track.swift; sourceTree = "<group>"; };
3536
021E1AF01944D4A800FDC37C /* TrackCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrackCell.swift; sourceTree = "<group>"; };
37+
021E1AF21944E0C200FDC37C /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
3638
022889EE193FC3AC00D729A0 /* DetailsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DetailsViewController.swift; path = Classes/DetailsViewController.swift; sourceTree = "<group>"; };
3739
022889F0193FD6C000D729A0 /* Album.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Album.swift; path = Classes/Album.swift; sourceTree = "<group>"; };
3840
0229AE62193F97EF00BCED97 /* Blank52.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Blank52.png; sourceTree = "<group>"; };
@@ -54,6 +56,7 @@
5456
isa = PBXFrameworksBuildPhase;
5557
buildActionMask = 2147483647;
5658
files = (
59+
021E1AF31944E0C200FDC37C /* QuartzCore.framework in Frameworks */,
5760
);
5861
runOnlyForDeploymentPostprocessing = 0;
5962
};
@@ -106,6 +109,7 @@
106109
02CCF499193D16930069AEE9 = {
107110
isa = PBXGroup;
108111
children = (
112+
021E1AF21944E0C200FDC37C /* QuartzCore.framework */,
109113
02CCF4A4193D16930069AEE9 /* TestSwift */,
110114
02CCF4B7193D16930069AEE9 /* TestSwiftTests */,
111115
02CCF4A3193D16930069AEE9 /* Products */,

TestSwift/Base.lproj/Main.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
1717
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
1818
<subviews>
19-
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="jTM-Fb-meD">
19+
<tableView clipsSubviews="YES" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="jTM-Fb-meD">
2020
<rect key="frame" x="0.0" y="37" width="480" height="443"/>
2121
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2222
<prototypes>
@@ -44,7 +44,7 @@
4444
</connections>
4545
</tableViewCell>
4646
</prototypes>
47-
<variation key="widthClass=compact" fixedFrame="YES">
47+
<variation key="widthClass=compact" ambiguous="YES" misplaced="YES">
4848
<rect key="frame" x="0.0" y="37" width="320" height="443"/>
4949
</variation>
5050
<variation key="heightClass=regular-widthClass=compact" ambiguous="YES" misplaced="YES">
@@ -112,7 +112,7 @@
112112
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
113113
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
114114
<prototypes>
115-
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="TrackCell" id="q8P-5k-V04" customClass="TrackCell" customModule="TestSwift" customModuleProvider="target">
115+
<tableViewCell contentMode="scaleToFill" ambiguous="YES" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="TrackCell" id="q8P-5k-V04" customClass="TrackCell" customModule="TestSwift" customModuleProvider="target">
116116
<autoresizingMask key="autoresizingMask"/>
117117
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="q8P-5k-V04" id="Hvr-uO-kzf">
118118
<autoresizingMask key="autoresizingMask"/>
@@ -155,7 +155,7 @@
155155
</connections>
156156
</tableViewCell>
157157
</prototypes>
158-
<variation key="widthClass=compact" fixedFrame="YES">
158+
<variation key="widthClass=compact" ambiguous="YES" misplaced="YES">
159159
<rect key="frame" x="20" y="179" width="280" height="281"/>
160160
</variation>
161161
<variation key="heightClass=regular-widthClass=compact" ambiguous="YES" misplaced="YES">

TestSwift/Classes/DetailsViewController.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import UIKit
10+
import QuartzCore
1011

1112
class DetailsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, APIControllerProtocol {
1213

@@ -87,9 +88,19 @@ class DetailsViewController: UIViewController, UITableViewDelegate, UITableViewD
8788
return tracks.count
8889
}
8990

91+
func tableView(tableView: UITableView!, willDisplayCell cell: UITableViewCell!, forRowAtIndexPath indexPath: NSIndexPath!) {
92+
93+
cell.layer.transform = CATransform3DMakeScale(0.1,0.1,1)
94+
95+
UIView.beginAnimations("animInCell", context: nil)
96+
cell.layer.transform = CATransform3DMakeScale(1,1,1)
97+
UIView.commitAnimations()
98+
}
99+
90100
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
91101
var cell = tableView.dequeueReusableCellWithIdentifier("TrackCell") as TrackCell
92102

103+
93104
var track = tracks[indexPath.row]
94105
cell.titleLabel.text = track.title
95106

TestSwift/SearchResultsViewController.swift

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

99
import UIKit
10+
import QuartzCore
1011

1112
class SearchResultsViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, APIControllerProtocol {
1213

@@ -39,6 +40,13 @@ class SearchResultsViewController: UIViewController, UITableViewDataSource, UITa
3940
return albums.count
4041
}
4142

43+
func tableView(tableView: UITableView!, willDisplayCell cell: UITableViewCell!, forRowAtIndexPath indexPath: NSIndexPath!) {
44+
cell.layer.transform = CATransform3DMakeScale(0.1,0.1,1)
45+
46+
UIView.beginAnimations("animInCell", context: nil)
47+
cell.layer.transform = CATransform3DMakeScale(1,1,1)
48+
UIView.commitAnimations()
49+
}
4250

4351
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
4452

0 commit comments

Comments
 (0)