Skip to content

Commit

Permalink
Finish till 5.8 (layer flattening)
Browse files Browse the repository at this point in the history
  • Loading branch information
raheelahmad committed Jul 15, 2014
1 parent f2ac43c commit e1e543e
Show file tree
Hide file tree
Showing 19 changed files with 775 additions and 5 deletions.
56 changes: 56 additions & 0 deletions CABook/CABook.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
594B738C1974F2CE004C2735 /* InfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 594B738A1974F2CE004C2735 /* InfoViewController.swift */; };
594B738D1974F2CE004C2735 /* InfoViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 594B738B1974F2CE004C2735 /* InfoViewController.xib */; };
594B73901974F99E004C2735 /* FlatteningViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 594B738E1974F99E004C2735 /* FlatteningViewController.swift */; };
594B73911974F99E004C2735 /* FlatteningViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 594B738F1974F99E004C2735 /* FlatteningViewController.xib */; };
5986AA5A19725020000F0835 /* GroupOpacityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5986AA5819725020000F0835 /* GroupOpacityViewController.swift */; };
5986AA5B19725020000F0835 /* GroupOpacityViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5986AA5919725020000F0835 /* GroupOpacityViewController.xib */; };
5986AA5F1972ACA9000F0835 /* PerspectiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5986AA5E1972ACA9000F0835 /* PerspectiveViewController.swift */; };
5986AA631972AE7A000F0835 /* PerspectiveViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5986AA621972AE7A000F0835 /* PerspectiveViewController.xib */; };
59C354D7196E0A89003BEFED /* MasksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C354D5196E0A89003BEFED /* MasksViewController.swift */; };
59C354D8196E0A89003BEFED /* MasksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 59C354D6196E0A89003BEFED /* MasksViewController.xib */; };
59C49125196818A8002F75E9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C49124196818A8002F75E9 /* AppDelegate.swift */; };
Expand All @@ -15,6 +23,10 @@
59C4914019681A59002F75E9 /* ClockViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C4913E19681A59002F75E9 /* ClockViewController.swift */; };
59C4914119681A59002F75E9 /* ClockViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 59C4913F19681A59002F75E9 /* ClockViewController.xib */; };
59C491431968E878002F75E9 /* ListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59C491421968E878002F75E9 /* ListViewController.swift */; };
59FED01E19736E5A005B056E /* SublayerTransformViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FED01C19736E5A005B056E /* SublayerTransformViewController.swift */; };
59FED01F19736E5A005B056E /* SublayerTransformViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 59FED01D19736E5A005B056E /* SublayerTransformViewController.xib */; };
59FED022197371F7005B056E /* BackviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59FED020197371F7005B056E /* BackviewViewController.swift */; };
59FED023197371F7005B056E /* BackviewViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 59FED021197371F7005B056E /* BackviewViewController.xib */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -28,6 +40,14 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
594B738A1974F2CE004C2735 /* InfoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoViewController.swift; sourceTree = "<group>"; };
594B738B1974F2CE004C2735 /* InfoViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = InfoViewController.xib; sourceTree = "<group>"; };
594B738E1974F99E004C2735 /* FlatteningViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlatteningViewController.swift; sourceTree = "<group>"; };
594B738F1974F99E004C2735 /* FlatteningViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = FlatteningViewController.xib; sourceTree = "<group>"; };
5986AA5819725020000F0835 /* GroupOpacityViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupOpacityViewController.swift; sourceTree = "<group>"; };
5986AA5919725020000F0835 /* GroupOpacityViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GroupOpacityViewController.xib; sourceTree = "<group>"; };
5986AA5E1972ACA9000F0835 /* PerspectiveViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerspectiveViewController.swift; sourceTree = "<group>"; };
5986AA621972AE7A000F0835 /* PerspectiveViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PerspectiveViewController.xib; sourceTree = "<group>"; };
59C354D5196E0A89003BEFED /* MasksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MasksViewController.swift; sourceTree = "<group>"; };
59C354D6196E0A89003BEFED /* MasksViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MasksViewController.xib; sourceTree = "<group>"; };
59C4911F196818A8002F75E9 /* CABook.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CABook.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -40,6 +60,10 @@
59C4913E19681A59002F75E9 /* ClockViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClockViewController.swift; sourceTree = "<group>"; };
59C4913F19681A59002F75E9 /* ClockViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ClockViewController.xib; sourceTree = "<group>"; };
59C491421968E878002F75E9 /* ListViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListViewController.swift; sourceTree = "<group>"; };
59FED01C19736E5A005B056E /* SublayerTransformViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SublayerTransformViewController.swift; sourceTree = "<group>"; };
59FED01D19736E5A005B056E /* SublayerTransformViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SublayerTransformViewController.xib; sourceTree = "<group>"; };
59FED020197371F7005B056E /* BackviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackviewViewController.swift; sourceTree = "<group>"; };
59FED021197371F7005B056E /* BackviewViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BackviewViewController.xib; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -60,11 +84,28 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
5986AA5D1972AC95000F0835 /* Chapter 5 */ = {
isa = PBXGroup;
children = (
5986AA5E1972ACA9000F0835 /* PerspectiveViewController.swift */,
5986AA621972AE7A000F0835 /* PerspectiveViewController.xib */,
59FED01C19736E5A005B056E /* SublayerTransformViewController.swift */,
59FED01D19736E5A005B056E /* SublayerTransformViewController.xib */,
59FED020197371F7005B056E /* BackviewViewController.swift */,
59FED021197371F7005B056E /* BackviewViewController.xib */,
594B738E1974F99E004C2735 /* FlatteningViewController.swift */,
594B738F1974F99E004C2735 /* FlatteningViewController.xib */,
);
name = "Chapter 5";
sourceTree = "<group>";
};
59C354D4196E0A77003BEFED /* Chapter 4 */ = {
isa = PBXGroup;
children = (
59C354D5196E0A89003BEFED /* MasksViewController.swift */,
59C354D6196E0A89003BEFED /* MasksViewController.xib */,
5986AA5819725020000F0835 /* GroupOpacityViewController.swift */,
5986AA5919725020000F0835 /* GroupOpacityViewController.xib */,
);
name = "Chapter 4";
sourceTree = "<group>";
Expand Down Expand Up @@ -94,6 +135,8 @@
59C49124196818A8002F75E9 /* AppDelegate.swift */,
59C49126196818A8002F75E9 /* Images.xcassets */,
59C49122196818A8002F75E9 /* Supporting Files */,
594B738A1974F2CE004C2735 /* InfoViewController.swift */,
594B738B1974F2CE004C2735 /* InfoViewController.xib */,
);
path = CABook;
sourceTree = "<group>";
Expand Down Expand Up @@ -126,6 +169,7 @@
59C4913C196818DE002F75E9 /* Chapters */ = {
isa = PBXGroup;
children = (
5986AA5D1972AC95000F0835 /* Chapter 5 */,
59C354D4196E0A77003BEFED /* Chapter 4 */,
59C4913D196818E8002F75E9 /* Chapter 3 */,
59C491421968E878002F75E9 /* ListViewController.swift */,
Expand Down Expand Up @@ -221,9 +265,15 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
5986AA5B19725020000F0835 /* GroupOpacityViewController.xib in Resources */,
59C49127196818A8002F75E9 /* Images.xcassets in Resources */,
594B738D1974F2CE004C2735 /* InfoViewController.xib in Resources */,
59FED01F19736E5A005B056E /* SublayerTransformViewController.xib in Resources */,
594B73911974F99E004C2735 /* FlatteningViewController.xib in Resources */,
59C354D8196E0A89003BEFED /* MasksViewController.xib in Resources */,
59C4914119681A59002F75E9 /* ClockViewController.xib in Resources */,
5986AA631972AE7A000F0835 /* PerspectiveViewController.xib in Resources */,
59FED023197371F7005B056E /* BackviewViewController.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -243,7 +293,13 @@
files = (
59C49125196818A8002F75E9 /* AppDelegate.swift in Sources */,
59C4914019681A59002F75E9 /* ClockViewController.swift in Sources */,
594B73901974F99E004C2735 /* FlatteningViewController.swift in Sources */,
59FED022197371F7005B056E /* BackviewViewController.swift in Sources */,
59C354D7196E0A89003BEFED /* MasksViewController.swift in Sources */,
594B738C1974F2CE004C2735 /* InfoViewController.swift in Sources */,
5986AA5F1972ACA9000F0835 /* PerspectiveViewController.swift in Sources */,
5986AA5A19725020000F0835 /* GroupOpacityViewController.swift in Sources */,
59FED01E19736E5A005B056E /* SublayerTransformViewController.swift in Sources */,
59C491431968E878002F75E9 /* ListViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?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>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>76B40F24-0A8A-4B8B-B19F-8776DF1B98C8</string>
<key>IDESourceControlProjectName</key>
<string>CABook</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>3479137E-F792-485E-838F-B9CAB3A5010D</key>
<string>ssh://github.com/raheelahmad/CABook.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>CABook/CABook.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>3479137E-F792-485E-838F-B9CAB3A5010D</key>
<string>../../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh://github.com/raheelahmad/CABook.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>3479137E-F792-485E-838F-B9CAB3A5010D</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>3479137E-F792-485E-838F-B9CAB3A5010D</string>
<key>IDESourceControlWCCName</key>
<string>CABook</string>
</dict>
</array>
</dict>
</plist>
Binary file not shown.
59 changes: 59 additions & 0 deletions CABook/CABook/BackviewViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// BackviewViewController.swift
// CABook
//
// Created by Raheel Ahmad on 7/13/14.
// Copyright (c) 2014 Sakun Labs. All rights reserved.
//

import UIKit
import QuartzCore

@objc(BackviewViewController) class BackviewViewController: UIViewController {

@IBOutlet strong var tajView: UIImageView!

var timer: NSTimer?
var tickCount = 0

@IBAction func switchDoubleSidedness(sender: UISwitch) {
tajView.layer.doubleSided = sender.on
}

@IBAction func showInfo(sender: AnyObject) {
let info = "The doubleSided property controls whether the layer's back view (when rotated by 180° on its x or y axis) is a mirror of its front contents or not."
let infoVC = InfoViewController(info: info)
presentViewController(infoVC, animated: true, completion: nil)
}

override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
tajView.layer.borderColor = UIColor.darkGrayColor().CGColor
tajView.layer.borderWidth = 1.0
animate()
}

override func viewWillDisappear(animated: Bool) {
super.viewWillDisappear(animated)
timer!.invalidate()
}

func animate() {
timer = NSTimer.scheduledTimerWithTimeInterval(0.01, target: self, selector: "tick", userInfo: nil, repeats: true)
tickCount = 0
tick()
}

func tick() {
if tickCount > 360 {
tickCount = 0
}
let angle = Double(tickCount) * M_PI / 180
var transform = CATransform3DIdentity
transform.m34 = -1/500.0
transform = CATransform3DRotate(transform, CGFloat(angle), 0, 1, 0)
tajView.layer.transform = transform

tickCount++
}
}
63 changes: 63 additions & 0 deletions CABook/CABook/BackviewViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6185.7" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6181.2"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="BackviewViewController" customModule="CABook" customModuleProvider="target">
<connections>
<outlet property="tajView" destination="Ysy-iS-Vlf" id="4FH-ge-FBM"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="taj-mahal" translatesAutoresizingMaskIntoConstraints="NO" id="Ysy-iS-Vlf">
<rect key="frame" x="90" y="127" width="300" height="225"/>
<constraints>
<constraint firstAttribute="height" constant="225" id="DFE-D6-OcP"/>
<constraint firstAttribute="width" constant="300" id="N0W-oA-nPA"/>
</constraints>
</imageView>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rPL-q3-D4e">
<rect key="frame" x="90" y="391" width="51" height="31"/>
<connections>
<action selector="switchDoubleSidedness:" destination="-1" eventType="valueChanged" id="35k-JA-4mm"/>
</connections>
</switch>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DOUBLE SIDED" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o97-KH-cpi">
<rect key="frame" x="147" y="408" width="83" height="13.5"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="11"/>
<color key="textColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="infoDark" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sKQ-pX-Wkv">
<rect key="frame" x="414" y="435" width="22" height="22"/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="showInfo:" destination="-1" eventType="touchUpInside" id="y8s-hn-3TE"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="Ysy-iS-Vlf" secondAttribute="centerX" id="3sy-Xt-wdm"/>
<constraint firstItem="rPL-q3-D4e" firstAttribute="top" secondItem="Ysy-iS-Vlf" secondAttribute="bottom" constant="39" id="9sw-yT-A7C"/>
<constraint firstAttribute="centerY" secondItem="Ysy-iS-Vlf" secondAttribute="centerY" constant="0.5" id="DFg-qB-Yv2"/>
<constraint firstItem="rPL-q3-D4e" firstAttribute="bottom" secondItem="o97-KH-cpi" secondAttribute="bottom" constant="0.5" id="HE2-xV-to4"/>
<constraint firstAttribute="bottom" secondItem="sKQ-pX-Wkv" secondAttribute="bottom" constant="23" id="HEa-uV-aTA"/>
<constraint firstItem="o97-KH-cpi" firstAttribute="leading" secondItem="rPL-q3-D4e" secondAttribute="trailing" constant="8" id="fQt-yr-KvM"/>
<constraint firstItem="rPL-q3-D4e" firstAttribute="leading" secondItem="Ysy-iS-Vlf" secondAttribute="leading" id="gTL-xn-29l"/>
<constraint firstAttribute="trailing" secondItem="sKQ-pX-Wkv" secondAttribute="trailing" constant="44" id="mPK-YW-cX2"/>
</constraints>
</view>
</objects>
<resources>
<image name="taj-mahal" width="300" height="225"/>
</resources>
</document>
Loading

0 comments on commit e1e543e

Please sign in to comment.