Permalink
Browse files

Add new flip style: Inward

  • Loading branch information...
mpospese committed May 16, 2012
1 parent f24c3cc commit dfacc6098fe1aa660bc202c6f1fae234ae63ce99
@@ -17,20 +17,25 @@
// Horizontal = page flips right to left about a vertical spine
// Vertical = page flips bottom to top about a horizontal spine
+// Bit 2: Perspective - Outward (unset) vs. Inward (set)
+// Outward = page flips towards viewer
+// Inward = page flips away from viewer
+
// TODO: spine position (left, mid, right // top, mid, bottom)
enum {
// current view folds away into center, next view slides in flat from top & bottom
MPFlipStyleDefault = 0,
MPFlipStyleDirectionBackward = 1 << 0,
- MPFlipStyleVertical = 1 << 1
+ MPFlipStyleVertical = 1 << 1,
+ MPFlipStyleInward = 1 << 2
};
typedef NSUInteger MPFlipStyle;
#define MPFlipStyleDirectionMask MPFlipStyleDirectionBackward
#define MPFlipStyleOrientationMask MPFlipStyleVertical
+#define MPFlipStylePerspectiveMask MPFlipStyleInward
static inline MPFlipStyle MPFlipStyleFlipDirectionBit(MPFlipStyle style) { return (style & ~MPFlipStyleDirectionMask) | ((style & MPFlipStyleDirectionMask) == MPFlipStyleDirectionBackward? 0 : MPFlipStyleDirectionBackward); }
-
#endif
@@ -82,6 +82,7 @@ - (void)perform:(void (^)(BOOL finished))completion
{
BOOL forwards = ([self style] & MPFlipStyleDirectionMask) != MPFlipStyleDirectionBackward;
BOOL vertical = ([self style] & MPFlipStyleOrientationMask) == MPFlipStyleVertical;
+ BOOL inward = ([self style] & MPFlipStylePerspectiveMask) == MPFlipStyleInward;
CGRect bounds = self.rect;
CGFloat scale = [[UIScreen mainScreen] scale];
@@ -249,6 +250,8 @@ - (void)perform:(void (^)(BOOL finished))completion
transform.m34 = -1.0/(height * 4.6666667);
else
transform.m34 = [self m34];
+ if (inward)
+ transform.m34 = -transform.m34; // flip perspective around
mainView.layer.sublayerTransform = transform;
NSString *rotationKey = vertical? @"transform.rotation.x" : @"transform.rotation.y";
@@ -254,6 +254,46 @@
</tableViewCell>
</cells>
</tableViewSection>
+ <tableViewSection headerTitle="Perspective" id="37w-ml-eDR">
+ <cells>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="NLU-7W-yLV" style="IBUITableViewCellStyleDefault" id="Wnh-TL-D3z">
+ <rect key="frame" x="0.0" y="242" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Outward" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="NLU-7W-yLV">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="oWZ-ZT-wLL" style="IBUITableViewCellStyleDefault" id="uTf-lO-sEM">
+ <rect key="frame" x="0.0" y="286" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Inward" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="oWZ-ZT-wLL">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="iUX-9O-Kqh" id="ERy-44-cYQ"/>
@@ -499,6 +539,37 @@
<point key="canvasLocation" x="751" y="747"/>
</scene>
</scenes>
+ <classes>
+ <class className="AboutViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/AboutViewController.h"/>
+ <relationships>
+ <relationship kind="action" name="donePressed:"/>
+ </relationships>
+ </class>
+ <class className="DetailsViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/DetailsViewController.h"/>
+ <relationships>
+ <relationship kind="action" name="popPressed:"/>
+ </relationships>
+ </class>
+ <class className="StyleTable" superclassName="UITableViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/StyleTable.h"/>
+ <relationships>
+ <relationship kind="action" name="donePressed:"/>
+ </relationships>
+ </class>
+ <class className="ViewController" superclassName="UIViewController">
+ <source key="sourceIdentifier" type="project" relativePath="./Classes/ViewController.h"/>
+ <relationships>
+ <relationship kind="action" name="detailPressed:"/>
+ <relationship kind="action" name="infoPressed:"/>
+ <relationship kind="action" name="modeValueChanged:"/>
+ <relationship kind="action" name="stepperValueChanged:"/>
+ <relationship kind="action" name="stylePressed:" candidateClass="UIBarButtonItem"/>
+ <relationship kind="outlet" name="contentView" candidateClass="UIView"/>
+ </relationships>
+ </class>
+ </classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar" statusBarStyle="blackTranslucent"/>
<simulatedOrientationMetrics key="orientation"/>
@@ -346,6 +346,46 @@
</tableViewCell>
</cells>
</tableViewSection>
+ <tableViewSection headerTitle="Perspective" id="9JZ-VR-Eaa">
+ <cells>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="slD-Y3-cVq" style="IBUITableViewCellStyleDefault" id="FwA-9A-LWv">
+ <rect key="frame" x="0.0" y="242" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Outward" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="slD-Y3-cVq">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ <tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" textLabel="HTl-hg-zDL" style="IBUITableViewCellStyleDefault" id="4c3-5d-dCN">
+ <rect key="frame" x="0.0" y="286" width="320" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <label opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="left" text="Inward" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="HTl-hg-zDL">
+ <rect key="frame" x="10" y="0.0" width="300" height="43"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <fontDescription key="fontDescription" type="boldSystem" pointSize="20"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="highlightedColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </view>
+ </tableViewCell>
+ </cells>
+ </tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="pmA-wI-nyX" id="V2z-jO-3HX"/>

0 comments on commit dfacc60

Please sign in to comment.