appjam 0.1.8.8 → 0.1.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -62
- data/lib/appjam/generators/gist.yml +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +1166 -482
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Prefix.pch.tt +26 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.m +412 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.h +44 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.m +97 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.h +167 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.m +639 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.h +97 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.m +1080 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.h +451 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.m +865 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.m +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.h +90 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.m +316 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.h +104 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.m +516 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldConstants.h +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.m +88 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.m +76 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.h +131 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.m +941 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide.psd +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide2.psd +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.h +46 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.m +82 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.h +39 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.m +72 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.m +100 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.h +34 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.m +140 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.h +17 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.m +57 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.h +30 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.m +233 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.h +19 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.m +122 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewDataSource.h +24 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.h +20 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.m +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.h +124 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.m +545 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.h +22 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.m +32 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.h +344 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.m +848 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.h +135 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.m +441 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.h +40 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.m +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.h +76 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.m +270 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.h +95 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.m +78 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.h +144 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.m +311 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.h +40 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.m +54 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.m +70 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.h +102 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.m +226 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.m +339 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.h +167 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.m +244 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageOperation.h +15 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.h +58 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.m +127 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.h +173 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.m +129 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.h +140 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.m +84 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationProgram.h +28 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationSequence.h +28 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationStep.h +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationProgram.m +100 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationSequence.m +85 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationStep.m +122 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.h +1074 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.m +7430 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.h +119 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.h +205 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.m +772 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.h +105 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.m +791 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.h +54 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.m +102 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.h +103 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.m +200 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.h +10 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.m +197 -0
- data/lib/appjam/version.rb +1 -1
- metadata +164 -3
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.h
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2012 Muh Hon Cheng
|
3
|
+
* Created by honcheng on 6/2/12.
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
* a copy of this software and associated documentation files (the
|
7
|
+
* "Software"), to deal in the Software without restriction, including
|
8
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
* permit persons to whom the Software is furnished to do so, subject
|
11
|
+
* to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
17
|
+
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
20
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
21
|
+
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
25
|
+
* IN CONNECTION WITH THE SOFTWARE OR
|
26
|
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
*
|
28
|
+
* @author Muh Hon Cheng <honcheng@gmail.com>
|
29
|
+
* @copyright 2012 Muh Hon Cheng
|
30
|
+
* @version
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
#import <UIKit/UIKit.h>
|
36
|
+
#import "ShadowView.h"
|
37
|
+
#import "PaperFoldConstants.h"
|
38
|
+
|
39
|
+
@interface FacingView : UIView
|
40
|
+
@property (strong, nonatomic) ShadowView *shadowView;
|
41
|
+
- (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection;
|
42
|
+
@end
|
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.m
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2012 Muh Hon Cheng
|
3
|
+
* Created by honcheng on 6/2/12.
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
* a copy of this software and associated documentation files (the
|
7
|
+
* "Software"), to deal in the Software without restriction, including
|
8
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
* permit persons to whom the Software is furnished to do so, subject
|
11
|
+
* to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
17
|
+
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
20
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
21
|
+
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
25
|
+
* IN CONNECTION WITH THE SOFTWARE OR
|
26
|
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
*
|
28
|
+
* @author Muh Hon Cheng <honcheng@gmail.com>
|
29
|
+
* @copyright 2012 Muh Hon Cheng
|
30
|
+
* @version
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
#import "FacingView.h"
|
35
|
+
|
36
|
+
@implementation FacingView
|
37
|
+
|
38
|
+
- (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection
|
39
|
+
{
|
40
|
+
self = [super initWithFrame:frame];
|
41
|
+
if (self) {
|
42
|
+
|
43
|
+
// add a shadow overlay on top of the view
|
44
|
+
_shadowView = [[ShadowView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height) foldDirection:foldDirection];
|
45
|
+
[self addSubview:_shadowView];
|
46
|
+
[_shadowView setBackgroundColor:[UIColor clearColor]];
|
47
|
+
}
|
48
|
+
return self;
|
49
|
+
}
|
50
|
+
|
51
|
+
- (id)initWithFrame:(CGRect)frame
|
52
|
+
{
|
53
|
+
return [self initWithFrame:frame foldDirection:FoldDirectionHorizontalRightToLeft];
|
54
|
+
}
|
55
|
+
|
56
|
+
@end
|
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.h
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2012 Muh Hon Cheng
|
3
|
+
* Created by honcheng on 6/2/12.
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
* a copy of this software and associated documentation files (the
|
7
|
+
* "Software"), to deal in the Software without restriction, including
|
8
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
* permit persons to whom the Software is furnished to do so, subject
|
11
|
+
* to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
17
|
+
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
20
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
21
|
+
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
25
|
+
* IN CONNECTION WITH THE SOFTWARE OR
|
26
|
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
*
|
28
|
+
* @author Muh Hon Cheng <honcheng@gmail.com>
|
29
|
+
* @copyright 2012 Muh Hon Cheng
|
30
|
+
* @version
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
#import <UIKit/UIKit.h>
|
36
|
+
#import "FacingView.h"
|
37
|
+
#import "FoldView.h"
|
38
|
+
|
39
|
+
@interface FoldView : UIView
|
40
|
+
|
41
|
+
// each folderView consists of 2 facing views: leftView and rightView
|
42
|
+
@property (nonatomic) FacingView *leftView, *rightView;
|
43
|
+
// or topView and bottomView
|
44
|
+
@property (nonatomic) FacingView *topView, *bottomView;
|
45
|
+
|
46
|
+
|
47
|
+
// indicate whether the fold is open or closed
|
48
|
+
@property (nonatomic, assign) FoldState state;
|
49
|
+
// wrapper of the visible view
|
50
|
+
@property (nonatomic) UIView *contentView;
|
51
|
+
@property (nonatomic, assign) FoldDirection foldDirection;
|
52
|
+
// optimized screenshot follows the scale of the screen
|
53
|
+
// non-optimized is always the non-retina image
|
54
|
+
@property (nonatomic, assign) BOOL useOptimizedScreenshot;
|
55
|
+
|
56
|
+
|
57
|
+
- (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection;
|
58
|
+
|
59
|
+
// unfold the 2 facing views using a fraction 0 to 1
|
60
|
+
// 0 when it's completely folded
|
61
|
+
// 1 when it's completely unfolded
|
62
|
+
// fraction is calculated based on parent offset
|
63
|
+
- (void)unfoldViewToFraction:(CGFloat)fraction;
|
64
|
+
|
65
|
+
// set fold states based on offset value
|
66
|
+
- (void)calculateFoldStateFromOffset:(float)offset;
|
67
|
+
|
68
|
+
// unfold the 2 facing views based on parent offset
|
69
|
+
- (void)unfoldWithParentOffset:(float)offset;
|
70
|
+
|
71
|
+
// set the visible view, to be added as a subview
|
72
|
+
- (void)setContent:(UIView *)contentView;
|
73
|
+
|
74
|
+
// take screenshot of the wrapper view layer, containing the visible view
|
75
|
+
- (void)drawScreenshotOnFolds;
|
76
|
+
|
77
|
+
// show/hide folds
|
78
|
+
- (void)showFolds:(BOOL)show;
|
79
|
+
|
80
|
+
// set the screenshot overlay on the 2 folds
|
81
|
+
// image gets spliced into 2, one for each folds
|
82
|
+
- (void)setImage:(UIImage*)image;
|
83
|
+
|
84
|
+
#pragma mark states
|
85
|
+
- (void)foldDidOpened;
|
86
|
+
- (void)foldDidClosed;
|
87
|
+
- (void)foldWillOpen;
|
88
|
+
- (void)foldWillClose;
|
89
|
+
|
90
|
+
@end
|
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.m
ADDED
@@ -0,0 +1,316 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2012 Muh Hon Cheng
|
3
|
+
* Created by honcheng on 6/2/12.
|
4
|
+
*
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
* a copy of this software and associated documentation files (the
|
7
|
+
* "Software"), to deal in the Software without restriction, including
|
8
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
* permit persons to whom the Software is furnished to do so, subject
|
11
|
+
* to the following conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
|
17
|
+
* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
18
|
+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
20
|
+
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
21
|
+
* SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
25
|
+
* IN CONNECTION WITH THE SOFTWARE OR
|
26
|
+
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
|
+
*
|
28
|
+
* @author Muh Hon Cheng <honcheng@gmail.com>
|
29
|
+
* @copyright 2012 Muh Hon Cheng
|
30
|
+
* @version
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
|
35
|
+
#import "FoldView.h"
|
36
|
+
#import <QuartzCore/QuartzCore.h>
|
37
|
+
#import "UIView+Screenshot.h"
|
38
|
+
|
39
|
+
@implementation FoldView
|
40
|
+
|
41
|
+
- (id)initWithFrame:(CGRect)frame
|
42
|
+
{
|
43
|
+
return [self initWithFrame:frame foldDirection:FoldDirectionHorizontalRightToLeft];
|
44
|
+
}
|
45
|
+
|
46
|
+
- (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection
|
47
|
+
{
|
48
|
+
self = [super initWithFrame:frame];
|
49
|
+
if (self) {
|
50
|
+
|
51
|
+
_useOptimizedScreenshot = YES;
|
52
|
+
_foldDirection = foldDirection;
|
53
|
+
|
54
|
+
// foldview consists of leftView & rightView (or topView & bottomView), and a content view
|
55
|
+
// set shadow direction of leftView and rightView such that the shadow falls on the fold in the middle
|
56
|
+
|
57
|
+
// content view holds a subview which is the actual displayed content
|
58
|
+
// contentView is required as a wrapper of the original content because it is better to take a screenshot of the wrapper view layer
|
59
|
+
// taking a screenshot of a tableview layer directly for example, may end up with blank view because of recycled cells
|
60
|
+
_contentView = [[UIView alloc] initWithFrame:CGRectMake(0,0,frame.size.width,frame.size.height)];
|
61
|
+
[_contentView setBackgroundColor:[UIColor clearColor]];
|
62
|
+
[self addSubview:_contentView];
|
63
|
+
|
64
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
65
|
+
{
|
66
|
+
// set anchor point of the leftView to the left edge
|
67
|
+
_leftView = [[FacingView alloc] initWithFrame:CGRectMake(-1*frame.size.width/4,0,frame.size.width/2,frame.size.height)];
|
68
|
+
[_leftView setBackgroundColor:[UIColor colorWithWhite:0.99 alpha:1]];
|
69
|
+
[_leftView.layer setAnchorPoint:CGPointMake(0.0, 0.5)];
|
70
|
+
[self addSubview:_leftView];
|
71
|
+
[_leftView.shadowView setColorArrays:[NSArray arrayWithObjects:[UIColor colorWithWhite:0 alpha:0.05],[UIColor colorWithWhite:0 alpha:0.6], nil]];
|
72
|
+
|
73
|
+
// set anchor point of the rightView to the right edge
|
74
|
+
_rightView = [[FacingView alloc] initWithFrame:CGRectMake(-1*frame.size.width/4,0,frame.size.width/2,frame.size.height)];
|
75
|
+
[_rightView setBackgroundColor:[UIColor colorWithWhite:0.99 alpha:1]];
|
76
|
+
[_rightView.layer setAnchorPoint:CGPointMake(1.0, 0.5)];
|
77
|
+
[self addSubview:_rightView];
|
78
|
+
[_rightView.shadowView setColorArrays:[NSArray arrayWithObjects:[UIColor colorWithWhite:0 alpha:0.9],[UIColor colorWithWhite:0 alpha:0.55], nil]];
|
79
|
+
|
80
|
+
// set perspective of the transformation
|
81
|
+
CATransform3D transform = CATransform3DIdentity;
|
82
|
+
transform.m34 = -1/500.0;
|
83
|
+
[self.layer setSublayerTransform:transform];
|
84
|
+
|
85
|
+
// make sure the views are closed properly when initialized
|
86
|
+
[_leftView.layer setTransform:CATransform3DMakeRotation((M_PI / 2), 0, 1, 0)];
|
87
|
+
[_rightView.layer setTransform:CATransform3DMakeRotation((M_PI / 2), 0, 1, 0)];
|
88
|
+
}
|
89
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
90
|
+
{
|
91
|
+
// set anchor point of the leftView to the left edge
|
92
|
+
_bottomView = [[FacingView alloc] initWithFrame:CGRectMake(0,3*frame.size.height/4,frame.size.width,frame.size.height/2) foldDirection:FoldDirectionVertical];
|
93
|
+
[_bottomView setBackgroundColor:[UIColor colorWithWhite:0.99 alpha:1]];
|
94
|
+
[_bottomView.layer setAnchorPoint:CGPointMake(0.5, 1.0)];
|
95
|
+
[self addSubview:_bottomView];
|
96
|
+
[_bottomView.shadowView setColorArrays:[NSArray arrayWithObjects:[UIColor colorWithWhite:0 alpha:0.05],[UIColor colorWithWhite:0 alpha:0.6], nil]];
|
97
|
+
|
98
|
+
// set anchor point of the rightView to the right edge
|
99
|
+
_topView = [[FacingView alloc] initWithFrame:CGRectMake(0,3*frame.size.height/4,frame.size.width,frame.size.height/2) foldDirection:FoldDirectionVertical];
|
100
|
+
[_topView setBackgroundColor:[UIColor colorWithWhite:0.99 alpha:1]];
|
101
|
+
[_topView.layer setAnchorPoint:CGPointMake(0.5, 0.0)];
|
102
|
+
[self addSubview:_topView];
|
103
|
+
[_topView.shadowView setColorArrays:[NSArray arrayWithObjects:[UIColor colorWithWhite:0 alpha:0.9],[UIColor colorWithWhite:0 alpha:0.55], nil]];
|
104
|
+
|
105
|
+
// set perspective of the transformation
|
106
|
+
CATransform3D transform = CATransform3DIdentity;
|
107
|
+
transform.m34 = -1/500.0;
|
108
|
+
[self.layer setSublayerTransform:transform];
|
109
|
+
|
110
|
+
// make sure the views are closed properly when initialized
|
111
|
+
[_bottomView.layer setTransform:CATransform3DMakeRotation((M_PI / 2), 1, 0, 0)];
|
112
|
+
[_topView.layer setTransform:CATransform3DMakeRotation((M_PI / 2), 1, 0, 0)];
|
113
|
+
}
|
114
|
+
|
115
|
+
[self setAutoresizesSubviews:YES];
|
116
|
+
[_contentView setAutoresizesSubviews:YES];
|
117
|
+
[_contentView setAutoresizingMask:UIViewAutoresizingFlexibleHeight];
|
118
|
+
}
|
119
|
+
return self;
|
120
|
+
}
|
121
|
+
|
122
|
+
- (void)unfoldViewToFraction:(CGFloat)fraction
|
123
|
+
{
|
124
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
125
|
+
{
|
126
|
+
float delta = asinf(fraction);
|
127
|
+
|
128
|
+
// rotate leftView on the left edge of the view
|
129
|
+
[self.leftView.layer setTransform:CATransform3DMakeRotation((M_PI / 2) - delta, 0, 1, 0)];
|
130
|
+
|
131
|
+
// rotate rightView on the right edge of the view
|
132
|
+
// translate rotated view to the left to join to the edge of the leftView
|
133
|
+
CATransform3D transform1 = CATransform3DMakeTranslation(2*self.leftView.frame.size.width, 0, 0);
|
134
|
+
CATransform3D transform2 = CATransform3DMakeRotation((M_PI / 2) - delta, 0, -1, 0);
|
135
|
+
CATransform3D transform = CATransform3DConcat(transform2, transform1);
|
136
|
+
[self.rightView.layer setTransform:transform];
|
137
|
+
|
138
|
+
// fade in shadow when folding
|
139
|
+
// fade out shadow when unfolding
|
140
|
+
[self.leftView.shadowView setAlpha:1-fraction];
|
141
|
+
[self.rightView.shadowView setAlpha:1-fraction];
|
142
|
+
}
|
143
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
144
|
+
{
|
145
|
+
float delta = asinf(fraction);
|
146
|
+
|
147
|
+
// rotate bottomView on the left edge of the view
|
148
|
+
[self.bottomView.layer setTransform:CATransform3DMakeRotation((M_PI / 2) - delta, 1, 0, 0)];
|
149
|
+
|
150
|
+
// rotate topView on the right edge of the view
|
151
|
+
// translate rotated view to the bottom to join to the edge of the bottomView
|
152
|
+
CATransform3D transform1 = CATransform3DMakeTranslation(0, -2*self.bottomView.frame.size.height, 0);
|
153
|
+
CATransform3D transform2 = CATransform3DMakeRotation((M_PI / 2) - delta, -1, 0, 0);
|
154
|
+
CATransform3D transform = CATransform3DConcat(transform2, transform1);
|
155
|
+
[self.topView.layer setTransform:transform];
|
156
|
+
|
157
|
+
// fade in shadow when folding
|
158
|
+
// fade out shadow when unfolding
|
159
|
+
[self.bottomView.shadowView setAlpha:1-fraction];
|
160
|
+
[self.topView.shadowView setAlpha:1-fraction];
|
161
|
+
}
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
// set fold states based on offset value
|
166
|
+
- (void)calculateFoldStateFromOffset:(float)offset
|
167
|
+
{
|
168
|
+
CGFloat fraction = 0.0;
|
169
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
170
|
+
{
|
171
|
+
fraction = offset / self.frame.size.width;
|
172
|
+
if (fraction < 0) fraction = 0;
|
173
|
+
if (fraction > 1) fraction = 1;
|
174
|
+
}
|
175
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
176
|
+
{
|
177
|
+
fraction = offset / self.frame.size.height;
|
178
|
+
if (fraction < 0) fraction = -1*fraction;
|
179
|
+
if (fraction > 1) fraction = 1;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (self.state==FoldStateClosed && fraction>0)
|
183
|
+
{
|
184
|
+
self.state = FoldStateTransition;
|
185
|
+
[self foldWillOpen];
|
186
|
+
}
|
187
|
+
else if (self.state==FoldStateOpened && fraction<1)
|
188
|
+
{
|
189
|
+
self.state = FoldStateTransition;
|
190
|
+
[self foldWillClose];
|
191
|
+
|
192
|
+
}
|
193
|
+
else if (self.state==FoldStateTransition)
|
194
|
+
{
|
195
|
+
if (fraction==0)
|
196
|
+
{
|
197
|
+
self.state = FoldStateClosed;
|
198
|
+
[self foldDidClosed];
|
199
|
+
}
|
200
|
+
else if (fraction==1)
|
201
|
+
{
|
202
|
+
self.state = FoldStateOpened;
|
203
|
+
[self foldDidOpened];
|
204
|
+
}
|
205
|
+
}
|
206
|
+
}
|
207
|
+
|
208
|
+
- (void)unfoldWithParentOffset:(float)offset
|
209
|
+
{
|
210
|
+
[self calculateFoldStateFromOffset:offset];
|
211
|
+
|
212
|
+
CGFloat fraction = 0.0;
|
213
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
214
|
+
{
|
215
|
+
fraction = offset / self.frame.size.width;
|
216
|
+
if (fraction < 0) fraction = 0;
|
217
|
+
if (fraction > 1) fraction = 1;
|
218
|
+
|
219
|
+
[self unfoldViewToFraction:fraction];
|
220
|
+
}
|
221
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
222
|
+
{
|
223
|
+
fraction = offset / self.frame.size.height;
|
224
|
+
if (fraction < 0) fraction = -1*fraction;
|
225
|
+
if (fraction > 1) fraction = 1;
|
226
|
+
}
|
227
|
+
[self unfoldViewToFraction:fraction];
|
228
|
+
}
|
229
|
+
|
230
|
+
- (void)setImage:(UIImage*)image
|
231
|
+
{
|
232
|
+
// split the image into 2, one for each folds
|
233
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
234
|
+
{
|
235
|
+
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, 0, image.size.width*image.scale/2, image.size.height*image.scale));
|
236
|
+
[self.leftView.layer setContents:(__bridge id)imageRef];
|
237
|
+
CFRelease(imageRef);
|
238
|
+
|
239
|
+
CGImageRef imageRef2 = CGImageCreateWithImageInRect([image CGImage], CGRectMake(image.size.width*image.scale/2, 0, image.size.width*image.scale/2, image.size.height*image.scale));
|
240
|
+
[self.rightView.layer setContents:(__bridge id)imageRef2];
|
241
|
+
CFRelease(imageRef2);
|
242
|
+
}
|
243
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
244
|
+
{
|
245
|
+
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, image.size.height*image.scale/2, image.size.width*image.scale, image.size.height*image.scale/2));
|
246
|
+
[self.bottomView.layer setContents:(__bridge id)imageRef];
|
247
|
+
CFRelease(imageRef);
|
248
|
+
|
249
|
+
CGImageRef imageRef2 = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, 0, image.size.width*image.scale, image.size.height*image.scale/2));
|
250
|
+
[self.topView.layer setContents:(__bridge id)imageRef2];
|
251
|
+
CFRelease(imageRef2);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
|
255
|
+
- (void)setContent:(UIView *)contentView
|
256
|
+
{
|
257
|
+
// add the actual visible view, as a subview of _contentView
|
258
|
+
[contentView setFrame:CGRectMake(0,0,contentView.frame.size.width,contentView.frame.size.height)];
|
259
|
+
[self.contentView addSubview:contentView];
|
260
|
+
[self drawScreenshotOnFolds];
|
261
|
+
}
|
262
|
+
|
263
|
+
|
264
|
+
- (void)drawScreenshotOnFolds
|
265
|
+
{
|
266
|
+
UIImage *image = [self.contentView screenshotWithOptimization:self.useOptimizedScreenshot];
|
267
|
+
[self setImage:image];
|
268
|
+
}
|
269
|
+
|
270
|
+
- (void)showFolds:(BOOL)show
|
271
|
+
{
|
272
|
+
if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
|
273
|
+
{
|
274
|
+
[self.leftView setHidden:!show];
|
275
|
+
[self.rightView setHidden:!show];
|
276
|
+
}
|
277
|
+
else if (self.foldDirection==FoldDirectionVertical)
|
278
|
+
{
|
279
|
+
[self.topView setHidden:!show];
|
280
|
+
[self.bottomView setHidden:!show];
|
281
|
+
}
|
282
|
+
|
283
|
+
}
|
284
|
+
|
285
|
+
#pragma mark states
|
286
|
+
|
287
|
+
- (void)foldDidOpened
|
288
|
+
{
|
289
|
+
//NSLog(@"opened");
|
290
|
+
[self.contentView setHidden:NO];
|
291
|
+
[self showFolds:NO];
|
292
|
+
}
|
293
|
+
|
294
|
+
- (void)foldDidClosed
|
295
|
+
{
|
296
|
+
//NSLog(@"closed");
|
297
|
+
[self.contentView setHidden:NO];
|
298
|
+
[self showFolds:YES];
|
299
|
+
}
|
300
|
+
|
301
|
+
- (void)foldWillOpen
|
302
|
+
{
|
303
|
+
//NSLog(@"transition - opening");
|
304
|
+
//[self drawScreenshotOnFolds];
|
305
|
+
[self.contentView setHidden:YES];
|
306
|
+
[self showFolds:YES];
|
307
|
+
}
|
308
|
+
|
309
|
+
- (void)foldWillClose
|
310
|
+
{
|
311
|
+
//NSLog(@"transition - closing");
|
312
|
+
[self drawScreenshotOnFolds];
|
313
|
+
[_contentView setHidden:YES];
|
314
|
+
[self showFolds:YES];
|
315
|
+
}
|
316
|
+
@end
|