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.
Files changed (168) hide show
  1. data/README.md +22 -62
  2. data/lib/appjam/generators/gist.yml +1 -1
  3. data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +1166 -482
  4. data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  5. data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Prefix.pch.tt +26 -0
  6. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.h +52 -0
  7. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.m +412 -0
  8. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.h +44 -0
  9. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.m +97 -0
  10. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted.png +0 -0
  11. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted@2x.png +0 -0
  12. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton.png +0 -0
  13. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton@2x.png +0 -0
  14. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted.png +0 -0
  15. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted@2x.png +0 -0
  16. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem.png +0 -0
  17. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem@2x.png +0 -0
  18. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted.png +0 -0
  19. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted@2x.png +0 -0
  20. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus.png +0 -0
  21. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus@2x.png +0 -0
  22. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star.png +0 -0
  23. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star@2x.png +0 -0
  24. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.h +167 -0
  25. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.m +639 -0
  26. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.h +97 -0
  27. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.m +1080 -0
  28. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.h +451 -0
  29. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.m +865 -0
  30. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.h +42 -0
  31. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.m +56 -0
  32. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.h +90 -0
  33. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.m +316 -0
  34. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.h +104 -0
  35. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.m +516 -0
  36. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldConstants.h +49 -0
  37. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.h +18 -0
  38. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.m +88 -0
  39. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left.png +0 -0
  40. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left@2x.png +0 -0
  41. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right.png +0 -0
  42. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right@2x.png +0 -0
  43. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.h +25 -0
  44. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.m +76 -0
  45. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.h +131 -0
  46. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.m +941 -0
  47. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide.psd +0 -0
  48. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide2.psd +0 -0
  49. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.h +46 -0
  50. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.m +82 -0
  51. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.h +39 -0
  52. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.m +72 -0
  53. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.h +42 -0
  54. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.m +100 -0
  55. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.h +34 -0
  56. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.m +140 -0
  57. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.h +17 -0
  58. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.m +57 -0
  59. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.h +30 -0
  60. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.m +233 -0
  61. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.h +19 -0
  62. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.m +122 -0
  63. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewDataSource.h +24 -0
  64. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.h +20 -0
  65. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.m +56 -0
  66. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine.png +0 -0
  67. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine@2x.png +0 -0
  68. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone.png +0 -0
  69. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone@2x.png +0 -0
  70. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar.png +0 -0
  71. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar@2x.png +0 -0
  72. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine.png +0 -0
  73. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine@2x.png +0 -0
  74. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone.png +0 -0
  75. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone@2x.png +0 -0
  76. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.h +124 -0
  77. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.m +545 -0
  78. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.h +22 -0
  79. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.m +32 -0
  80. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.h +344 -0
  81. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.m +848 -0
  82. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.h +135 -0
  83. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.m +441 -0
  84. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.h +40 -0
  85. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.m +36 -0
  86. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.h +76 -0
  87. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.m +270 -0
  88. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.h +95 -0
  89. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.m +78 -0
  90. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.h +144 -0
  91. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.m +311 -0
  92. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.h +40 -0
  93. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.m +54 -0
  94. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.h +18 -0
  95. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.m +70 -0
  96. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.h +102 -0
  97. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.m +226 -0
  98. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.h +25 -0
  99. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.m +339 -0
  100. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.h +167 -0
  101. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.m +244 -0
  102. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageOperation.h +15 -0
  103. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.h +58 -0
  104. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.m +127 -0
  105. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.h +173 -0
  106. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.m +129 -0
  107. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.h +140 -0
  108. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.m +84 -0
  109. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationProgram.h +28 -0
  110. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationSequence.h +28 -0
  111. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationStep.h +49 -0
  112. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationProgram.m +100 -0
  113. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationSequence.m +85 -0
  114. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationStep.m +122 -0
  115. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.h +1074 -0
  116. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.m +7430 -0
  117. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
  118. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
  119. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
  120. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
  121. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
  122. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
  123. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
  124. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
  125. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.h +119 -0
  126. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
  127. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
  128. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
  129. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
  130. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
  131. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.h +205 -0
  132. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.m +772 -0
  133. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
  134. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
  135. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
  136. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
  137. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
  138. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
  139. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
  140. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
  141. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
  142. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
  143. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
  144. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
  145. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
  146. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
  147. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
  148. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
  149. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
  150. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
  151. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.h +105 -0
  152. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.m +791 -0
  153. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
  154. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
  155. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
  156. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
  157. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
  158. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
  159. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
  160. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
  161. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.h +54 -0
  162. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.m +102 -0
  163. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.h +103 -0
  164. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.m +200 -0
  165. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.h +10 -0
  166. data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.m +197 -0
  167. data/lib/appjam/version.rb +1 -1
  168. metadata +164 -3
@@ -0,0 +1,104 @@
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
+ @class MKMapView;
35
+ #import <UIKit/UIKit.h>
36
+ #import "FoldView.h"
37
+
38
+ @protocol MultiFoldViewDelegate <NSObject>
39
+ - (CGFloat)displacementOfMultiFoldView:(id)multiFoldView;
40
+ @end
41
+
42
+ @interface MultiFoldView : UIView
43
+ // number of folds
44
+ @property (nonatomic, assign) int numberOfFolds;
45
+ // fraction of the view on the right to its immediate left
46
+ // determines when the next fold on the right should open
47
+ @property (nonatomic, assign) float pullFactor;
48
+ // indicate whether the fold is open or closed
49
+ @property (nonatomic, assign) FoldState state;
50
+ // fold direction
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
+ // take screenshot just before unfolding
56
+ // this is only necessary for mapview, not for the rest of the views
57
+ @property (nonatomic, readonly) BOOL shouldTakeScreenshotBeforeUnfolding;
58
+
59
+ @property (nonatomic, strong) UIView *contentViewHolder;
60
+
61
+ @property (nonatomic, assign) id<MultiFoldViewDelegate> delegate;
62
+
63
+ // init with the number of folds and pull factor
64
+
65
+ // defaults to horizontal fold
66
+ - (id)initWithFrame:(CGRect)frame folds:(int)folds pullFactor:(float)pullFactor;
67
+ - (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection folds:(int)folds pullFactor:(float)pullFactor;
68
+
69
+ // set the content of the view
70
+ - (void)setContent:(UIView *)contentView;
71
+ // get screenshot of content to overlay in folds
72
+ - (void)drawScreenshotOnFolds;
73
+ - (void)setScreenshotImage:(UIImage*)image;
74
+
75
+ // set fold states based on offset value
76
+ - (void)calculateFoldStateFromOffset:(float)offset;
77
+
78
+ // unfold the based on parent offset
79
+ - (void)unfoldWithParentOffset:(float)offset;
80
+
81
+ // unfold using a fraction 0 to 1
82
+ // 0 when it's completely folded
83
+ // 1 when it's completely unfolded
84
+ // fraction is calculated based on parent offset
85
+ - (void)unfoldViewToFraction:(CGFloat)fraction;
86
+
87
+ // unfold foldView using fraction
88
+ - (void)unfoldView:(FoldView*)foldView toFraction:(CGFloat)fraction withOffset:(float)offset;
89
+
90
+ // show/hide all folds
91
+ - (void)showFolds:(BOOL)show;
92
+
93
+ // unfold without animation
94
+ // temporary method
95
+ - (void)unfoldWithoutAnimation;
96
+
97
+ #pragma mark states
98
+ // states of folds
99
+ - (void)foldDidOpened;
100
+ - (void)foldDidClosed;
101
+ - (void)foldWillOpen;
102
+ - (void)foldWillClose;
103
+
104
+ @end
@@ -0,0 +1,516 @@
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 "MultiFoldView.h"
36
+ #import "UIView+Screenshot.h"
37
+ #import <MapKit/MapKit.h>
38
+
39
+ @implementation MultiFoldView
40
+
41
+ #define FOLDVIEW_TAG 1000
42
+
43
+ - (id)initWithFrame:(CGRect)frame foldDirection:(FoldDirection)foldDirection folds:(int)folds pullFactor:(float)factor
44
+ {
45
+ self = [super initWithFrame:frame];
46
+ if (self) {
47
+
48
+ _useOptimizedScreenshot = YES;
49
+ _foldDirection = foldDirection;
50
+ _numberOfFolds = folds;
51
+ if (_numberOfFolds==1)
52
+ {
53
+ // no pull factor required if there is only one fold
54
+ _pullFactor = 0;
55
+ }
56
+ else _pullFactor = factor;
57
+
58
+ // create multiple FoldView next to each other
59
+ for (int i=0; i<_numberOfFolds; i++)
60
+ {
61
+ if (_foldDirection==FoldDirectionHorizontalLeftToRight || _foldDirection==FoldDirectionHorizontalRightToLeft)
62
+ {
63
+ float foldWidth = frame.size.width/self.numberOfFolds;
64
+ FoldView *foldView = [[FoldView alloc] initWithFrame:CGRectMake(foldWidth*i,0,foldWidth,frame.size.height) foldDirection:foldDirection];
65
+ [foldView setTag:FOLDVIEW_TAG+i];
66
+ [self addSubview:foldView];
67
+ }
68
+ else if (_foldDirection==FoldDirectionVertical)
69
+ {
70
+ float foldHeight = frame.size.height/self.numberOfFolds;
71
+ FoldView *foldView = [[FoldView alloc] initWithFrame:CGRectMake(0,foldHeight*(self.numberOfFolds-i)-foldHeight,frame.size.width,foldHeight) foldDirection:foldDirection];
72
+ [foldView setTag:FOLDVIEW_TAG+i];
73
+ [self addSubview:foldView];
74
+ }
75
+ }
76
+ [self setAutoresizesSubviews:YES];
77
+ }
78
+ return self;
79
+ }
80
+
81
+ - (void)setFrame:(CGRect)frame
82
+ {
83
+ [super setFrame:frame];
84
+
85
+ CGRect contentViewHolderFrame = [self.contentViewHolder frame];
86
+ contentViewHolderFrame.size.height = frame.size.height;
87
+ [self.contentViewHolder setFrame:contentViewHolderFrame];
88
+
89
+
90
+ for (UIView *subview in self.subviews)
91
+ {
92
+ if ([subview isKindOfClass:[FoldView class]]) [subview removeFromSuperview];
93
+ }
94
+
95
+ for (int i=0; i<_numberOfFolds; i++)
96
+ {
97
+ if (_foldDirection==FoldDirectionHorizontalLeftToRight || _foldDirection==FoldDirectionHorizontalRightToLeft)
98
+ {
99
+ float foldWidth = frame.size.width/self.numberOfFolds;
100
+ FoldView *foldView = [[FoldView alloc] initWithFrame:CGRectMake(foldWidth*i,0,foldWidth,frame.size.height) foldDirection:_foldDirection];
101
+ [foldView setTag:FOLDVIEW_TAG+i];
102
+ [self addSubview:foldView];
103
+ }
104
+ else if (_foldDirection==FoldDirectionVertical)
105
+ {
106
+ float foldHeight = frame.size.height/self.numberOfFolds;
107
+ FoldView *foldView = [[FoldView alloc] initWithFrame:CGRectMake(0,foldHeight*(self.numberOfFolds-i)-foldHeight,frame.size.width,foldHeight) foldDirection:_foldDirection];
108
+ [foldView setTag:FOLDVIEW_TAG+i];
109
+ [self addSubview:foldView];
110
+ }
111
+ }
112
+
113
+ // for (int i=0; i<_numberOfFolds; i++)
114
+ // {
115
+ // if (_foldDirection==FoldDirectionHorizontalLeftToRight || _foldDirection==FoldDirectionHorizontalRightToLeft)
116
+ // {
117
+ // float foldWidth = frame.size.width/self.numberOfFolds;
118
+ // FoldView *foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+i];
119
+ // [foldView setFrame:CGRectMake(foldWidth*i,0,foldWidth,frame.size.height)];
120
+ // }
121
+ // else if (_foldDirection==FoldDirectionVertical)
122
+ // {
123
+ // float foldHeight = frame.size.height/self.numberOfFolds;
124
+ // FoldView *foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+i];
125
+ // [foldView setFrame:CGRectMake(0,foldHeight*(self.numberOfFolds-i)-foldHeight,frame.size.width,foldHeight)];
126
+ // }
127
+ // }
128
+ }
129
+
130
+ - (id)initWithFrame:(CGRect)frame folds:(int)folds pullFactor:(float)factor
131
+ {
132
+ return [self initWithFrame:frame foldDirection:FoldDirectionHorizontalRightToLeft folds:folds pullFactor:factor];
133
+ }
134
+
135
+ - (void)setContent:(UIView *)contentView
136
+ {
137
+ if ([contentView isKindOfClass:NSClassFromString(@"MKMapView")]) _shouldTakeScreenshotBeforeUnfolding = YES;
138
+
139
+ // set the content view
140
+ self.contentViewHolder = [[UIView alloc] initWithFrame:CGRectMake(0,0,contentView.frame.size.width,contentView.frame.size.height)];
141
+ //[self.contentView setFrame:CGRectMake(0,0,contentView.frame.size.width,contentView.frame.size.height)];
142
+ [self.contentViewHolder setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight];
143
+ // place content view below folds
144
+ [self insertSubview:self.contentViewHolder atIndex:0];
145
+ [self.contentViewHolder addSubview:contentView];
146
+ // immediately take a screenshot of the content view to overlay in fold
147
+ // if content view is a map view, screenshot will be a blank grid
148
+ [self drawScreenshotOnFolds];
149
+ [self.contentViewHolder setHidden:YES];
150
+
151
+ // // set the content view
152
+ // self.contentView = contentView;
153
+ // [self.contentView setFrame:CGRectMake(0,0,contentView.frame.size.width,contentView.frame.size.height)];
154
+ // [self.contentView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleWidth];
155
+ // // place content view below folds
156
+ // [self insertSubview:self.contentView atIndex:0];
157
+ // // immediately take a screenshot of the content view to overlay in fold
158
+ // // if content view is a map view, screenshot will be a blank grid
159
+ // [self drawScreenshotOnFolds];
160
+ // [self.contentView setHidden:YES];
161
+ }
162
+
163
+ - (void)drawScreenshotOnFolds
164
+ {
165
+ UIImage *image = [self.contentViewHolder screenshotWithOptimization:self.useOptimizedScreenshot];
166
+ [self setScreenshotImage:image];
167
+ // get screenshot of content view, and splice the image to overlay in different folds
168
+
169
+ }
170
+
171
+ - (void)setScreenshotImage:(UIImage*)image
172
+ {
173
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight || self.foldDirection==FoldDirectionHorizontalRightToLeft)
174
+ {
175
+ float foldWidth = image.size.width/self.numberOfFolds;
176
+
177
+ for (int i=0; i<self.numberOfFolds; i++)
178
+ {
179
+ CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(foldWidth*i*image.scale, 0, foldWidth*image.scale, image.size.height*image.scale));
180
+ if (imageRef)
181
+ {
182
+ UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
183
+ CFRelease(imageRef);
184
+ FoldView *foldView = nil;
185
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight) {
186
+ foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG + (self.numberOfFolds - 1) - i];
187
+ } else {
188
+ foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+i];
189
+ }
190
+ [foldView setImage:croppedImage];
191
+ }
192
+
193
+ }
194
+ }
195
+ else if (self.foldDirection==FoldDirectionVertical)
196
+ {
197
+ float foldHeight = image.size.height/self.numberOfFolds;
198
+ for (int i=0; i<self.numberOfFolds; i++)
199
+ {
200
+ CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, foldHeight*(self.numberOfFolds-i-1)*image.scale, image.size.width*image.scale, foldHeight*image.scale));
201
+ if (imageRef)
202
+ {
203
+ UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
204
+ CFRelease(imageRef);
205
+ FoldView *foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+i];
206
+ [foldView setImage:croppedImage];
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ // set fold states based on offset value
213
+ - (void)calculateFoldStateFromOffset:(float)offset
214
+ {
215
+ CGFloat fraction = 0.0;
216
+ if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
217
+ {
218
+ if (offset < 0)
219
+ fraction = -1*offset/self.frame.size.width;
220
+ else
221
+ fraction = offset/self.frame.size.width;
222
+ }
223
+ else if (self.foldDirection==FoldDirectionVertical)
224
+ {
225
+ fraction = offset/self.frame.size.height;
226
+ }
227
+
228
+ if (_state==FoldStateClosed && fraction>0)
229
+ {
230
+ _state = FoldStateTransition;
231
+ [self foldWillOpen];
232
+ }
233
+ else if (_state==FoldStateOpened && fraction<1)
234
+ {
235
+ _state = FoldStateTransition;
236
+ [self foldWillClose];
237
+ }
238
+ else if (_state==FoldStateTransition)
239
+ {
240
+ if (fraction==0)
241
+ {
242
+ _state = FoldStateClosed;
243
+ [self foldDidClosed];
244
+ }
245
+ else if (fraction>=1)
246
+ {
247
+ _state = FoldStateOpened;
248
+ [self foldDidOpened];
249
+ }
250
+ }
251
+ }
252
+
253
+ // use the parent offset to calculate fraction
254
+ - (void)unfoldWithParentOffset:(float)offset
255
+ {
256
+ [self calculateFoldStateFromOffset:offset];
257
+
258
+ if (self.foldDirection==FoldDirectionHorizontalRightToLeft || self.foldDirection==FoldDirectionHorizontalLeftToRight)
259
+ {
260
+ float foldWidth = self.frame.size.width/self.numberOfFolds;
261
+ CGFloat fraction;
262
+ if (offset < 0) {
263
+ if (offset<-1*(foldWidth+self.pullFactor*foldWidth))
264
+ {
265
+ offset = -1*(foldWidth+self.pullFactor*foldWidth);
266
+ }
267
+ fraction = offset /(-1*(foldWidth+self.pullFactor*foldWidth));
268
+ } else {
269
+ if (offset > (foldWidth+self.pullFactor*foldWidth))
270
+ {
271
+ offset = (foldWidth+self.pullFactor*foldWidth);
272
+ }
273
+ fraction = offset /(foldWidth+self.pullFactor*foldWidth);
274
+ }
275
+ //fraction = offset /(-1*(foldWidth+self.pullFactor*foldWidth));
276
+
277
+ if (fraction < 0) fraction = -1*fraction;//0;
278
+ if (fraction > 1) fraction = 1;
279
+ [self unfoldViewToFraction:fraction];
280
+ }
281
+ else if (self.foldDirection==FoldDirectionVertical)
282
+ {
283
+ float foldHeight = self.frame.size.height/self.numberOfFolds;
284
+
285
+ if (offset>(foldHeight+self.pullFactor*foldHeight))
286
+ {
287
+ offset = (foldHeight+self.pullFactor*foldHeight);
288
+ }
289
+
290
+ CGFloat fraction = offset /(foldHeight+self.pullFactor*foldHeight);
291
+ if (fraction < 0) fraction = -1*fraction;//0;
292
+ if (fraction > 1) fraction = 1;
293
+
294
+ [self unfoldViewToFraction:fraction];
295
+ }
296
+ }
297
+
298
+ - (void)unfoldViewToFraction:(CGFloat)fraction
299
+ {
300
+ // start the cascading effect of unfolding
301
+ // with the first foldView with index FOLDVIEW_TAG+0
302
+ FoldView *firstFoldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG];
303
+
304
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight)
305
+ {
306
+ float offset = 0.0;
307
+ if ([self.delegate respondsToSelector:@selector(displacementOfMultiFoldView:)])
308
+ {
309
+ offset = [self.delegate displacementOfMultiFoldView:self];
310
+ }
311
+ else
312
+ {
313
+ offset = self.superview.frame.origin.x;
314
+ }
315
+ if (offset<0) offset = -1*offset;
316
+ [self unfoldView:firstFoldView toFraction:fraction withOffset:offset];
317
+ }
318
+ else [self unfoldView:firstFoldView toFraction:fraction withOffset:0];
319
+ }
320
+
321
+ - (void)unfoldView:(FoldView*)foldView toFraction:(CGFloat)fraction withOffset:(float)offset
322
+ {
323
+ // unfold the subfold
324
+ [foldView unfoldViewToFraction:fraction];
325
+
326
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight || self.foldDirection==FoldDirectionHorizontalRightToLeft)
327
+ {
328
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight) {
329
+ [foldView setFrame:CGRectMake(offset - 2*foldView.rightView.frame.size.width, 0, foldView.frame.size.width, foldView.frame.size.height)];
330
+
331
+ }
332
+
333
+ // check if there is another subfold beside this fold
334
+ int index = [foldView tag] - FOLDVIEW_TAG;
335
+ if (index < self.numberOfFolds-1)
336
+ {
337
+ FoldView *nextFoldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+index+1];
338
+ // set the origin of the next foldView
339
+ // set the origin of the next foldView
340
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight) {
341
+ [nextFoldView setFrame:CGRectMake(foldView.frame.origin.x - 2*nextFoldView.rightView.frame.size.width,0,nextFoldView.frame.size.width,nextFoldView.frame.size.height)];
342
+ } else {
343
+ [nextFoldView setFrame:CGRectMake(foldView.frame.origin.x + 2*foldView.leftView.frame.size.width,0,nextFoldView.frame.size.width,nextFoldView.frame.size.height)];
344
+ }
345
+
346
+ float foldWidth = self.frame.size.width/self.numberOfFolds;
347
+ // calculate the offset between the right edge of the last subfold, and the edge of the screen
348
+ // use this offset to readjust the fraction
349
+ float displacement = 0.0;
350
+ if ([self.delegate respondsToSelector:@selector(displacementOfMultiFoldView:)])
351
+ {
352
+ displacement = [self.delegate displacementOfMultiFoldView:self];
353
+ }
354
+ else
355
+ {
356
+ displacement = self.superview.frame.origin.x;
357
+ }
358
+
359
+ float x;
360
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight) {
361
+ //x = (foldView.frame.origin.x + (fraction * foldView.frame.size.width)) - 2*foldView.rightView.frame.size.width;
362
+ x = (foldView.frame.origin.x + (fraction * foldView.frame.size.width)) - 2*foldView.rightView.frame.size.width;
363
+ //x = displacement - x;
364
+
365
+ } else{
366
+ x = displacement+foldView.frame.origin.x+2*foldView.leftView.frame.size.width;
367
+ //x = self.superview.frame.origin.x+foldView.frame.origin.x+2*foldView.leftView.frame.size.width;
368
+ }
369
+
370
+ //float x = self.superview.frame.origin.x+foldView.frame.origin.x+2*foldView.leftView.frame.size.width;
371
+ CGFloat adjustedFraction = 0;
372
+ if (self.foldDirection==FoldDirectionHorizontalLeftToRight) {
373
+ x = -x;
374
+ }
375
+ if (index+1==self.numberOfFolds-1)
376
+ {
377
+ // if this is the last fold, do not use the pull factor
378
+ // so that the right edge of this subfold aligns with the right edge of the screen
379
+ adjustedFraction = (-1*x)/(foldWidth);
380
+ }
381
+ else
382
+ {
383
+ // if this is not the last fold, use the pull factor
384
+ adjustedFraction = (-1*x)/(foldWidth+self.pullFactor*foldWidth);
385
+ }
386
+ if (adjustedFraction < 0) adjustedFraction = 0;
387
+ if (adjustedFraction > 1) adjustedFraction = 1;
388
+
389
+ // unfold this foldView with the fraction
390
+ // by calling the same function
391
+ // this drills in to the next subfold in a cascading effect depending on the number of available folds
392
+
393
+ //[self unfoldView:nextFoldView toFraction:adjustedFraction];
394
+ //NSLog(@"%@ %f", foldView, foldView.frame.origin.x);
395
+ [self unfoldView:nextFoldView toFraction:adjustedFraction withOffset:foldView.frame.origin.x];
396
+ }
397
+ }
398
+ else if (self.foldDirection==FoldDirectionVertical)
399
+ {
400
+ // check if there is another subfold beside this fold
401
+ int index = [foldView tag] - FOLDVIEW_TAG;
402
+
403
+ if (index < self.numberOfFolds-1)
404
+ {
405
+ FoldView *nextFoldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+index+1];
406
+ // set the origin of the next foldView
407
+ [nextFoldView setFrame:CGRectMake(0,foldView.frame.origin.y - 2*foldView.bottomView.frame.size.height,nextFoldView.frame.size.width,nextFoldView.frame.size.height)];
408
+
409
+ float foldHeight = self.frame.size.height/self.numberOfFolds;
410
+ // calculate the offset between the right edge of the last subfold, and the edge of the screen
411
+ // use this offset to readjust the fraction
412
+ float displacement = 0.0;
413
+ if ([self.delegate respondsToSelector:@selector(displacementOfMultiFoldView:)])
414
+ {
415
+ displacement = [self.delegate displacementOfMultiFoldView:self];
416
+ }
417
+ else
418
+ {
419
+ if ([self.superview isKindOfClass:[UIScrollView class]])
420
+ {
421
+ displacement = -1*[(UIScrollView*)self.superview contentOffset].y;
422
+ }
423
+ else
424
+ {
425
+ displacement = self.superview.frame.origin.y ;
426
+ }
427
+ }
428
+ float y = displacement - 2*foldView.bottomView.frame.size.height;
429
+ int _index = index - 1;
430
+ while (_index>=0)
431
+ {
432
+ FoldView *prevFoldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+_index];
433
+ y -= 2*prevFoldView.bottomView.frame.size.height;
434
+ _index -= 1;
435
+ }
436
+
437
+ CGFloat adjustedFraction = 0;
438
+ if (index+1==self.numberOfFolds-1)
439
+ {
440
+ // if this is the last fold, do not use the pull factor
441
+ // so that the right edge of this subfold aligns with the right edge of the screen
442
+ adjustedFraction = y/(foldHeight);
443
+ }
444
+ else
445
+ {
446
+ // if this is not the last fold, use the pull factor
447
+ adjustedFraction = y/(foldHeight+self.pullFactor*foldHeight);
448
+ }
449
+
450
+ if (adjustedFraction < 0) adjustedFraction = 0;
451
+ if (adjustedFraction > 1) adjustedFraction = 1;
452
+ // unfold this foldView with the fraction
453
+ // by calling the same function
454
+
455
+ // this drills in to the next subfold in a cascading effect depending on the number of available folds
456
+ [self unfoldView:nextFoldView toFraction:adjustedFraction withOffset:0];
457
+ }
458
+ }
459
+
460
+ }
461
+
462
+ // hide fold (when content view is visible) and show fold (when content view is hidden
463
+ - (void)showFolds:(BOOL)show
464
+ {
465
+ for (int i=0; i<self.numberOfFolds; i++)
466
+ {
467
+ FoldView *foldView = (FoldView*)[self viewWithTag:FOLDVIEW_TAG+i];
468
+ [foldView setHidden:!show];
469
+ }
470
+ }
471
+
472
+ - (void)unfoldWithoutAnimation
473
+ {
474
+ [self unfoldWithParentOffset:self.frame.size.width];
475
+ [self foldDidOpened];
476
+ }
477
+
478
+ #pragma mark states
479
+
480
+ // when fold is completely opened, hide fold and show content view
481
+ - (void)foldDidOpened
482
+ {
483
+ [self.contentViewHolder setHidden:NO];
484
+ [self showFolds:NO];
485
+ }
486
+
487
+ // when fold is completely closed, hide content view and folds
488
+ - (void)foldDidClosed
489
+ {
490
+ [self.contentViewHolder setHidden:YES];
491
+ [self showFolds:YES];
492
+ }
493
+
494
+ // when fold is about to be opened, make sure content view is hidden, and show fold
495
+ - (void)foldWillOpen
496
+ {
497
+ if (self.shouldTakeScreenshotBeforeUnfolding)
498
+ {
499
+ [self.contentViewHolder setHidden:NO];
500
+ [self drawScreenshotOnFolds];
501
+ }
502
+ [self.contentViewHolder setHidden:YES];
503
+ [self showFolds:YES];
504
+ }
505
+
506
+ // when fold is about to be closed, take a screenshot of the content view, hide it, and make sure fold is visible.
507
+ - (void)foldWillClose
508
+ {
509
+ [self drawScreenshotOnFolds];
510
+ [self.contentViewHolder setHidden:YES];
511
+ [self showFolds:YES];
512
+ }
513
+
514
+
515
+
516
+ @end