rubymotionr 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/.rspec +2 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +24 -0
- data/LICENSE.txt +22 -0
- data/README.md +31 -0
- data/Rakefile +1 -0
- data/lib/rubymotionr.rb +7 -0
- data/lib/rubymotionr/project.rb +18 -0
- data/lib/rubymotionr/repo.rb +18 -0
- data/lib/rubymotionr/version.rb +3 -0
- data/rubymotionr.gemspec +19 -0
- data/spec/.DS_Store +0 -0
- data/spec/multiple-rubymotion-apps/Beers/README +5 -0
- data/spec/multiple-rubymotion-apps/Beers/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/Beers/app/app_delegate.rb +16 -0
- data/spec/multiple-rubymotion-apps/Beers/app/beer.rb +22 -0
- data/spec/multiple-rubymotion-apps/Beers/app/beer_details_controller.rb +15 -0
- data/spec/multiple-rubymotion-apps/Beers/app/beer_list_controller.rb +40 -0
- data/spec/multiple-rubymotion-apps/Beers/app/beer_map_controller.rb +51 -0
- data/spec/multiple-rubymotion-apps/Beers/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Beers/resources/list.png +0 -0
- data/spec/multiple-rubymotion-apps/Beers/resources/map.png +0 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/.gitignore +5 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/README +5 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/Rakefile +9 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/app/app_delegate.rb +8 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/app/cell.rb +13 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/app/circle_layout.rb +41 -0
- data/spec/multiple-rubymotion-apps/CircleLayout/app/view_controller.rb +33 -0
- data/spec/multiple-rubymotion-apps/Fonts/README +7 -0
- data/spec/multiple-rubymotion-apps/Fonts/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/Fonts/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Fonts/app/detail_controller.rb +50 -0
- data/spec/multiple-rubymotion-apps/Fonts/app/root_controller.rb +65 -0
- data/spec/multiple-rubymotion-apps/Fonts/resources/.gitkeep +0 -0
- data/spec/multiple-rubymotion-apps/GestureTable/README +8 -0
- data/spec/multiple-rubymotion-apps/GestureTable/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/UIColor_extensions.rb +32 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/UITableView_extensions.rb +7 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/gesture_recognizer.rb +361 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/transformable_cells.rb +92 -0
- data/spec/multiple-rubymotion-apps/GestureTable/app/view_controller.rb +173 -0
- data/spec/multiple-rubymotion-apps/GestureTable/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Hello/README +3 -0
- data/spec/multiple-rubymotion-apps/Hello/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/Hello/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Hello/app/hello_view.rb +33 -0
- data/spec/multiple-rubymotion-apps/Hello/app/hello_view_controller.rb +5 -0
- data/spec/multiple-rubymotion-apps/Hello/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Hello/resources/icon.png +0 -0
- data/spec/multiple-rubymotion-apps/HelloGL/README +9 -0
- data/spec/multiple-rubymotion-apps/HelloGL/Rakefile +11 -0
- data/spec/multiple-rubymotion-apps/HelloGL/app/app_delegate.rb +16 -0
- data/spec/multiple-rubymotion-apps/HelloGL/app/index_data.rb +19 -0
- data/spec/multiple-rubymotion-apps/HelloGL/app/motiongl_controller.rb +139 -0
- data/spec/multiple-rubymotion-apps/HelloGL/app/vertex_data.rb +22 -0
- data/spec/multiple-rubymotion-apps/HelloGL/resources/rubymotion.png +0 -0
- data/spec/multiple-rubymotion-apps/Locations/README +3 -0
- data/spec/multiple-rubymotion-apps/Locations/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/Locations/app/app_delegate.rb +11 -0
- data/spec/multiple-rubymotion-apps/Locations/app/location.rb +21 -0
- data/spec/multiple-rubymotion-apps/Locations/app/locations_controller.rb +66 -0
- data/spec/multiple-rubymotion-apps/Locations/app/locations_store.rb +61 -0
- data/spec/multiple-rubymotion-apps/Locations/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/README +5 -0
- data/spec/multiple-rubymotion-apps/Mustache/Rakefile +10 -0
- data/spec/multiple-rubymotion-apps/Mustache/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Mustache/app/mustache_view_controller.rb +99 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/guido.jpg +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/jmccolor.jpg +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/kay.jpg +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/matz.jpg +0 -0
- data/spec/multiple-rubymotion-apps/Mustache/resources/mustache.png +0 -0
- data/spec/multiple-rubymotion-apps/Paint/README +3 -0
- data/spec/multiple-rubymotion-apps/Paint/Rakefile +8 -0
- data/spec/multiple-rubymotion-apps/Paint/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Paint/app/paint_view.rb +57 -0
- data/spec/multiple-rubymotion-apps/Paint/app/paint_view_controller.rb +13 -0
- data/spec/multiple-rubymotion-apps/Paint/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Paint/resources/erase.caf +0 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/README +8 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/Rakefile +10 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/app/app_delegate.rb +10 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/app/web_view_controller.rb +48 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/resources/index.html +211 -0
- data/spec/multiple-rubymotion-apps/PaintHTML/resources/index2.html +14 -0
- data/spec/multiple-rubymotion-apps/README.rdoc +47 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/README.md +42 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/Rakefile +7 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/app/app_delegate.rb +12 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/app/custom_view_controller1.rb +31 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/app/custom_view_controller2.rb +29 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/app/helpers.rb +4 -0
- data/spec/multiple-rubymotion-apps/StoryboardCustoms/resources/Master.storyboard +127 -0
- data/spec/multiple-rubymotion-apps/TicTacToe/.gitignore +5 -0
- data/spec/multiple-rubymotion-apps/TicTacToe/Rakefile +7 -0
- data/spec/multiple-rubymotion-apps/TicTacToe/app/app_delegate.rb +8 -0
- data/spec/multiple-rubymotion-apps/TicTacToe/app/board.rb +59 -0
- data/spec/multiple-rubymotion-apps/TicTacToe/app/board_view_controller.rb +86 -0
- data/spec/multiple-rubymotion-apps/Timer/README +3 -0
- data/spec/multiple-rubymotion-apps/Timer/Rakefile +7 -0
- data/spec/multiple-rubymotion-apps/Timer/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Timer/app/timer_controller.rb +38 -0
- data/spec/multiple-rubymotion-apps/Timer/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Trollify/README +6 -0
- data/spec/multiple-rubymotion-apps/Trollify/Rakefile +9 -0
- data/spec/multiple-rubymotion-apps/Trollify/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Trollify/app/image_composition_controller.rb +193 -0
- data/spec/multiple-rubymotion-apps/Trollify/app/uiimage_extension.rb +27 -0
- data/spec/multiple-rubymotion-apps/Trollify/resources/.gitignore +0 -0
- data/spec/multiple-rubymotion-apps/Trollify/resources/ballmer.jpg +0 -0
- data/spec/multiple-rubymotion-apps/Trollify/resources/icon.png +0 -0
- data/spec/multiple-rubymotion-apps/Trollify/resources/icon@2x.png +0 -0
- data/spec/multiple-rubymotion-apps/Trollify/resources/trollface.png +0 -0
- data/spec/multiple-rubymotion-apps/Tweets/README +3 -0
- data/spec/multiple-rubymotion-apps/Tweets/Rakefile +7 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/app_delegate.rb +9 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/data_parser.rb +10 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/json_parser.rb +12 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/tweet.rb +11 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/tweet_cell.rb +51 -0
- data/spec/multiple-rubymotion-apps/Tweets/app/tweets_controller.rb +72 -0
- data/spec/multiple-rubymotion-apps/Tweets/resources/.gitignore +0 -0
- data/spec/repo_spec.rb +27 -0
- data/spec/rubymotion-example/.DS_Store +0 -0
- data/spec/rubymotion-example/README +3 -0
- data/spec/rubymotion-example/Rakefile +7 -0
- data/spec/rubymotion-example/app/app_delegate.rb +9 -0
- data/spec/rubymotion-example/app/data_parser.rb +10 -0
- data/spec/rubymotion-example/app/json_parser.rb +12 -0
- data/spec/rubymotion-example/app/tweet.rb +11 -0
- data/spec/rubymotion-example/app/tweet_cell.rb +51 -0
- data/spec/rubymotion-example/app/tweets_controller.rb +72 -0
- data/spec/rubymotion-example/resources/.gitignore +0 -0
- data/spec/spec_helper.rb +9 -0
- metadata +309 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
class CustomViewController2 < UIViewController
|
|
2
|
+
TAG_IDLABEL = 1
|
|
3
|
+
TAG_DESCRIPTION = 2
|
|
4
|
+
TAG_CUSTOMTEXT = 3
|
|
5
|
+
|
|
6
|
+
def awakeFromNib
|
|
7
|
+
# make sure our views are loaded
|
|
8
|
+
self.view
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def viewDidLoad
|
|
12
|
+
puts "#{self.to_s}: CustomViewController2::viewDidLoad"
|
|
13
|
+
self.title = "CustomVC2"
|
|
14
|
+
|
|
15
|
+
@idlabel = retrieve_subview_with_tag(self, TAG_IDLABEL)
|
|
16
|
+
@idlabel.text = self.to_s
|
|
17
|
+
|
|
18
|
+
@description = retrieve_subview_with_tag(self, TAG_DESCRIPTION)
|
|
19
|
+
@customtext = retrieve_subview_with_tag(self, TAG_CUSTOMTEXT)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def set_parent_id(id)
|
|
23
|
+
@description.text = "Custom text from #{id}:"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def customtext
|
|
27
|
+
@customtext
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="1.1" toolsVersion="2182" systemVersion="11D50b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="Epr-b1-yTT">
|
|
3
|
+
<dependencies>
|
|
4
|
+
<development defaultVersion="4200" identifier="xcode"/>
|
|
5
|
+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="1181"/>
|
|
6
|
+
</dependencies>
|
|
7
|
+
<scenes>
|
|
8
|
+
<!--Navigation Controller-->
|
|
9
|
+
<scene sceneID="kfI-5u-cvF">
|
|
10
|
+
<objects>
|
|
11
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="3qR-5T-JJE" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
12
|
+
<navigationController storyboardIdentifier="Main" definesPresentationContext="YES" id="Epr-b1-yTT" sceneMemberID="viewController">
|
|
13
|
+
<navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="SXQ-cd-C8T">
|
|
14
|
+
<autoresizingMask key="autoresizingMask"/>
|
|
15
|
+
</navigationBar>
|
|
16
|
+
<connections>
|
|
17
|
+
<segue destination="eT8-9G-O3I" kind="relationship" relationship="rootViewController" id="4da-fs-lXZ"/>
|
|
18
|
+
</connections>
|
|
19
|
+
</navigationController>
|
|
20
|
+
</objects>
|
|
21
|
+
<point key="canvasLocation" x="46" y="107"/>
|
|
22
|
+
</scene>
|
|
23
|
+
<!--Custom View Controller1-->
|
|
24
|
+
<scene sceneID="eFp-AT-OEl">
|
|
25
|
+
<objects>
|
|
26
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="GVw-FB-BWA" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
27
|
+
<viewController storyboardIdentifier="" id="eT8-9G-O3I" customClass="CustomViewController1" sceneMemberID="viewController">
|
|
28
|
+
<view key="view" contentMode="scaleToFill" id="OQc-qr-Qjb">
|
|
29
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
|
30
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
31
|
+
<subviews>
|
|
32
|
+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="YnF-E7-M4d">
|
|
33
|
+
<rect key="frame" x="108" y="296" width="105" height="37"/>
|
|
34
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
35
|
+
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
|
36
|
+
<state key="normal" title="To Subview">
|
|
37
|
+
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
|
38
|
+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
|
39
|
+
</state>
|
|
40
|
+
<state key="highlighted">
|
|
41
|
+
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
|
42
|
+
</state>
|
|
43
|
+
<connections>
|
|
44
|
+
<segue destination="LLH-R4-ehv" kind="push" identifier="Subview" id="MLk-Ic-Mvp"/>
|
|
45
|
+
</connections>
|
|
46
|
+
</button>
|
|
47
|
+
<textField opaque="NO" clipsSubviews="YES" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Type SubView label text here" minimumFontSize="17" id="2oR-ZR-5F8">
|
|
48
|
+
<rect key="frame" x="20" y="110" width="280" height="31"/>
|
|
49
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
50
|
+
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
|
51
|
+
<textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
|
|
52
|
+
</textField>
|
|
53
|
+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="1" contentMode="left" text="<placeholder>" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="yah-6O-tJC">
|
|
54
|
+
<rect key="frame" x="20" y="20" width="280" height="21"/>
|
|
55
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
56
|
+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
57
|
+
<color key="textColor" red="0.70196080207824707" green="0.70196080207824707" blue="0.70196080207824707" alpha="1" colorSpace="calibratedRGB"/>
|
|
58
|
+
<nil key="highlightedColor"/>
|
|
59
|
+
</label>
|
|
60
|
+
</subviews>
|
|
61
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
|
62
|
+
</view>
|
|
63
|
+
<navigationItem key="navigationItem" id="Cph-3U-7Rk"/>
|
|
64
|
+
</viewController>
|
|
65
|
+
</objects>
|
|
66
|
+
<point key="canvasLocation" x="492" y="107"/>
|
|
67
|
+
</scene>
|
|
68
|
+
<!--Custom View Controller2-->
|
|
69
|
+
<scene sceneID="UMY-rw-2E5">
|
|
70
|
+
<objects>
|
|
71
|
+
<placeholder placeholderIdentifier="IBFirstResponder" id="2Tl-ne-3wB" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
|
72
|
+
<viewController storyboardIdentifier="" id="LLH-R4-ehv" customClass="CustomViewController2" sceneMemberID="viewController">
|
|
73
|
+
<view key="view" contentMode="scaleToFill" id="mfS-Su-Ajq">
|
|
74
|
+
<rect key="frame" x="0.0" y="64" width="320" height="416"/>
|
|
75
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
76
|
+
<subviews>
|
|
77
|
+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="2" contentMode="left" text="Custom Text From <parent>:" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="hSu-if-qLg">
|
|
78
|
+
<rect key="frame" x="20" y="81" width="280" height="21"/>
|
|
79
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
80
|
+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
81
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
|
82
|
+
<nil key="highlightedColor"/>
|
|
83
|
+
</label>
|
|
84
|
+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="3" contentMode="left" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="4b1-Sw-SKt">
|
|
85
|
+
<rect key="frame" x="20" y="110" width="280" height="21"/>
|
|
86
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
87
|
+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
88
|
+
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
|
89
|
+
<nil key="highlightedColor"/>
|
|
90
|
+
</label>
|
|
91
|
+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="BDI-K9-IZC">
|
|
92
|
+
<rect key="frame" x="110" y="296" width="102" height="37"/>
|
|
93
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
94
|
+
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
|
|
95
|
+
<state key="normal" title="Push Loop">
|
|
96
|
+
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
|
|
97
|
+
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
|
98
|
+
</state>
|
|
99
|
+
<state key="highlighted">
|
|
100
|
+
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
|
101
|
+
</state>
|
|
102
|
+
<connections>
|
|
103
|
+
<segue destination="eT8-9G-O3I" kind="push" identifier="Master" id="D4L-X6-5Gg"/>
|
|
104
|
+
</connections>
|
|
105
|
+
</button>
|
|
106
|
+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="1" contentMode="left" text="<placeholder>" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="7pG-mB-Pm3">
|
|
107
|
+
<rect key="frame" x="20" y="20" width="280" height="21"/>
|
|
108
|
+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
109
|
+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
|
110
|
+
<color key="textColor" red="0.7019608021" green="0.7019608021" blue="0.7019608021" alpha="1" colorSpace="calibratedRGB"/>
|
|
111
|
+
<nil key="highlightedColor"/>
|
|
112
|
+
</label>
|
|
113
|
+
</subviews>
|
|
114
|
+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
|
115
|
+
</view>
|
|
116
|
+
<navigationItem key="navigationItem" id="sK8-9K-Ph6"/>
|
|
117
|
+
</viewController>
|
|
118
|
+
</objects>
|
|
119
|
+
<point key="canvasLocation" x="941" y="107"/>
|
|
120
|
+
</scene>
|
|
121
|
+
</scenes>
|
|
122
|
+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
|
123
|
+
<simulatedStatusBarMetrics key="statusBar"/>
|
|
124
|
+
<simulatedOrientationMetrics key="orientation"/>
|
|
125
|
+
<simulatedScreenMetrics key="destination"/>
|
|
126
|
+
</simulatedMetricsContainer>
|
|
127
|
+
</document>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AppDelegate
|
|
2
|
+
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
|
3
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
|
4
|
+
@window.rootViewController = BoardViewController.alloc.init
|
|
5
|
+
@window.makeKeyAndVisible
|
|
6
|
+
true
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
class Board
|
|
2
|
+
|
|
3
|
+
# @grid:
|
|
4
|
+
# +---+---+---+
|
|
5
|
+
# | 0 | 1 | 2 |
|
|
6
|
+
# +---+---+---+
|
|
7
|
+
# | 3 | 4 | 5 |
|
|
8
|
+
# +---+---+---+
|
|
9
|
+
# | 6 | 7 | 8 |
|
|
10
|
+
# +---+---+---+
|
|
11
|
+
|
|
12
|
+
attr_reader :grid
|
|
13
|
+
|
|
14
|
+
def initialize
|
|
15
|
+
# -1 for unset squares
|
|
16
|
+
@grid = Array.new(9, -1)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# returns false if illegal move
|
|
20
|
+
# and player id if it is legal
|
|
21
|
+
def move(square, player)
|
|
22
|
+
# check if square is taken
|
|
23
|
+
if not @grid[square] == -1
|
|
24
|
+
return false
|
|
25
|
+
end
|
|
26
|
+
@grid[square] = player
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# resets the grid
|
|
30
|
+
def reset
|
|
31
|
+
@grid.replace(Array.new(9, -1))
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# returns the id of the winner
|
|
35
|
+
# -1 for stalemate or false if
|
|
36
|
+
# game is not over
|
|
37
|
+
def game_over?
|
|
38
|
+
for i in 0..2
|
|
39
|
+
if @grid[3*i] != -1 && @grid[3*i] == @grid[3*i + 1] && @grid[3*i + 1] == @grid[3*i + 2]
|
|
40
|
+
return @grid[3*i]
|
|
41
|
+
elsif @grid[i] != -1 && @grid[i] == @grid[i + 3] && @grid[i + 3] == @grid[i + 6]
|
|
42
|
+
return @grid[i]
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
if @grid[0] != -1 && @grid[0] == @grid[4] && @grid[4] == @grid[8]
|
|
47
|
+
return @grid[0]
|
|
48
|
+
elsif @grid[2] != -1 && @grid[2] == @grid[4] && @grid[4] == @grid[6]
|
|
49
|
+
return @grid[2]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
if not @grid.include?(-1)
|
|
53
|
+
return -1
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
false
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
class BoardViewController < UIViewController
|
|
2
|
+
SQUARE_SIZE = 80
|
|
3
|
+
COLORS = [UIColor.greenColor, UIColor.redColor, UIColor.whiteColor]
|
|
4
|
+
|
|
5
|
+
def viewDidLoad
|
|
6
|
+
self.init_views
|
|
7
|
+
self.new_game
|
|
8
|
+
self.board_changed
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def init_views
|
|
12
|
+
view.backgroundColor = UIColor.blackColor
|
|
13
|
+
|
|
14
|
+
# view for the board
|
|
15
|
+
@board_view = UIView.alloc.initWithFrame([[0, 0], [SQUARE_SIZE * 3, SQUARE_SIZE * 3]])
|
|
16
|
+
@board_view.center = view.center
|
|
17
|
+
|
|
18
|
+
# views for the square
|
|
19
|
+
@square_views = []
|
|
20
|
+
for i in 0..2
|
|
21
|
+
for j in 0..2
|
|
22
|
+
square_view = UIView.alloc.initWithFrame([[j * (SQUARE_SIZE + 2), i * (SQUARE_SIZE + 2)], [SQUARE_SIZE - 4, SQUARE_SIZE - 4]])
|
|
23
|
+
square_view.layer.cornerRadius = 5.0
|
|
24
|
+
@square_views[3*i + j] = square_view
|
|
25
|
+
@board_view.addSubview(square_view)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# label for game information
|
|
30
|
+
@label = UILabel.alloc.initWithFrame([[0, 0], [0, 0]])
|
|
31
|
+
@label.textColor = UIColor.whiteColor
|
|
32
|
+
@label.font = UIFont.systemFontOfSize(30)
|
|
33
|
+
@label.backgroundColor = nil
|
|
34
|
+
|
|
35
|
+
view.addSubview(@label)
|
|
36
|
+
view.addSubview(@board_view)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def show_info(text)
|
|
40
|
+
@label.text = text
|
|
41
|
+
@label.sizeToFit
|
|
42
|
+
@label.center = [160, 50]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def new_game
|
|
46
|
+
# initalize the game
|
|
47
|
+
@board = Board.new
|
|
48
|
+
@current_player = 0
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def touchesEnded(touches, withEvent:event)
|
|
52
|
+
# check if we're touching a square
|
|
53
|
+
for i in 0..8
|
|
54
|
+
if event.touchesForView(@square_views[i])
|
|
55
|
+
if not @board.move(i, @current_player) then
|
|
56
|
+
show_info("Illegal move!")
|
|
57
|
+
break
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
@current_player += 1
|
|
61
|
+
@current_player %= 2
|
|
62
|
+
break
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# check if the game is over
|
|
67
|
+
if winner = @board.game_over?
|
|
68
|
+
@board.reset
|
|
69
|
+
if winner == -1
|
|
70
|
+
show_info("No one wins!")
|
|
71
|
+
elsif winner
|
|
72
|
+
show_info("Player #{winner + 1} wins!")
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
self.board_changed
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# update the square views
|
|
80
|
+
def board_changed
|
|
81
|
+
for i in 0..8
|
|
82
|
+
@square_views[i].backgroundColor = COLORS[@board.grid[i]]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AppDelegate
|
|
2
|
+
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
|
3
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
|
4
|
+
@window.rootViewController = TimerController.alloc.init
|
|
5
|
+
@window.rootViewController.wantsFullScreenLayout = true
|
|
6
|
+
@window.makeKeyAndVisible
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
class TimerController < UIViewController
|
|
2
|
+
attr_reader :timer
|
|
3
|
+
|
|
4
|
+
def viewDidLoad
|
|
5
|
+
margin = 20
|
|
6
|
+
|
|
7
|
+
@state = UILabel.new
|
|
8
|
+
@state.font = UIFont.systemFontOfSize(30)
|
|
9
|
+
@state.text = 'Tap to start'
|
|
10
|
+
@state.textAlignment = UITextAlignmentCenter
|
|
11
|
+
@state.textColor = UIColor.whiteColor
|
|
12
|
+
@state.backgroundColor = UIColor.clearColor
|
|
13
|
+
@state.frame = [[margin, 200], [view.frame.size.width - margin * 2, 40]]
|
|
14
|
+
view.addSubview(@state)
|
|
15
|
+
|
|
16
|
+
@action = UIButton.buttonWithType(UIButtonTypeRoundedRect)
|
|
17
|
+
@action.setTitle('Start', forState:UIControlStateNormal)
|
|
18
|
+
@action.setTitle('Stop', forState:UIControlStateSelected)
|
|
19
|
+
@action.addTarget(self, action:'actionTapped', forControlEvents:UIControlEventTouchUpInside)
|
|
20
|
+
@action.frame = [[margin, 260], [view.frame.size.width - margin * 2, 40]]
|
|
21
|
+
view.addSubview(@action)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def actionTapped
|
|
25
|
+
if @timer
|
|
26
|
+
@timer.invalidate
|
|
27
|
+
@timer = nil
|
|
28
|
+
else
|
|
29
|
+
@duration = 0
|
|
30
|
+
@timer = NSTimer.scheduledTimerWithTimeInterval(0.1, target:self, selector:'timerFired', userInfo:nil, repeats:true)
|
|
31
|
+
end
|
|
32
|
+
@action.selected = !@action.selected?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def timerFired
|
|
36
|
+
@state.text = "%.1f" % (@duration += 0.1)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Trollify.app
|
|
2
|
+
|
|
3
|
+
This sample demonstrates the following concepts: Images, Image Picker, Camera Roll, Action Sheet, Gestures.
|
|
4
|
+
|
|
5
|
+
This sample was contributed by Johannes Fahrenkrug, http://springenwerk.com
|
|
6
|
+
The app/uiimage_extension.rb file is derived from code by Hardy Macia, Catamount Software.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
$:.unshift("/Library/RubyMotion/lib")
|
|
2
|
+
require 'motion/project'
|
|
3
|
+
|
|
4
|
+
Motion::Project::App.setup do |app|
|
|
5
|
+
# Use `rake config' to see complete project settings.
|
|
6
|
+
app.name = 'trollify'
|
|
7
|
+
app.frameworks += ['QuartzCore', 'AssetsLibrary', 'MobileCoreServices']
|
|
8
|
+
app.icons = ['icon.png', 'icon@2x.png']
|
|
9
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AppDelegate
|
|
2
|
+
def application(application, didFinishLaunchingWithOptions:launchOptions)
|
|
3
|
+
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
|
|
4
|
+
@window.rootViewController = UINavigationController.alloc.initWithRootViewController(ImageCompositionController.alloc.init)
|
|
5
|
+
@window.rootViewController.wantsFullScreenLayout = true
|
|
6
|
+
@window.makeKeyAndVisible
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
class ImageCompositionController < UIViewController
|
|
2
|
+
def loadView
|
|
3
|
+
self.view = UIImageView.alloc.init
|
|
4
|
+
view.contentMode = UIViewContentModeScaleAspectFill
|
|
5
|
+
view.userInteractionEnabled = true
|
|
6
|
+
|
|
7
|
+
view.image = UIImage.imageNamed("ballmer.jpg")
|
|
8
|
+
view.addSubview(troll_image_view)
|
|
9
|
+
|
|
10
|
+
rotationGesture = UIRotationGestureRecognizer.alloc.initWithTarget(self, action: 'rotate_image:')
|
|
11
|
+
troll_image_view.addGestureRecognizer(rotationGesture)
|
|
12
|
+
|
|
13
|
+
panGesture = UIPanGestureRecognizer.alloc.initWithTarget(self, action: 'pan_image:')
|
|
14
|
+
panGesture.maximumNumberOfTouches = 2
|
|
15
|
+
panGesture.delegate = self
|
|
16
|
+
troll_image_view.addGestureRecognizer(panGesture)
|
|
17
|
+
|
|
18
|
+
pinchGesture = UIPinchGestureRecognizer.alloc.initWithTarget(self, action:'scale_image:')
|
|
19
|
+
pinchGesture.delegate = self
|
|
20
|
+
troll_image_view.addGestureRecognizer(pinchGesture)
|
|
21
|
+
|
|
22
|
+
navigationItem.leftBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Pick", style:UIBarButtonItemStylePlain, target:self, action:'show_source_sheet')
|
|
23
|
+
navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Save", style:UIBarButtonItemStylePlain, target:self, action:'save_image')
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def viewWillAppear(animated)
|
|
27
|
+
navigationController.setNavigationBarHidden(false, animated:true)
|
|
28
|
+
troll_image_view.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMidY(self.view.bounds))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def troll_image_view
|
|
32
|
+
@troll_image_view ||= begin
|
|
33
|
+
image = UIImageView.alloc.init
|
|
34
|
+
image.image = UIImage.imageNamed("trollface.png")
|
|
35
|
+
image.frame = CGRectMake(0, 0, image.image.size.width, image.image.size.height)
|
|
36
|
+
image.userInteractionEnabled = true
|
|
37
|
+
|
|
38
|
+
# Set initial scale of the trollface to a quarter.
|
|
39
|
+
image.transform = CGAffineTransformMakeScale(0.25, 0.25)
|
|
40
|
+
image
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Scale and rotation transforms are applied relative to the layer's anchor point.
|
|
45
|
+
# This method moves a gesture recognizer's view's anchor point between the user's fingers.
|
|
46
|
+
def adjust_anchor_point_for_gesture_recognizer(gestureRecognizer)
|
|
47
|
+
if gestureRecognizer.state == UIGestureRecognizerStateBegan
|
|
48
|
+
locationInView = gestureRecognizer.locationInView(troll_image_view)
|
|
49
|
+
locationInSuperview = gestureRecognizer.locationInView(troll_image_view.superview)
|
|
50
|
+
|
|
51
|
+
troll_image_view.layer.anchorPoint = CGPointMake(locationInView.x / troll_image_view.bounds.size.width, locationInView.y / troll_image_view.bounds.size.height)
|
|
52
|
+
troll_image_view.center = locationInSuperview
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def rotate_image(gestureRecognizer)
|
|
57
|
+
adjust_anchor_point_for_gesture_recognizer(gestureRecognizer)
|
|
58
|
+
if gestureRecognizer.state == UIGestureRecognizerStateBegan || gestureRecognizer.state == UIGestureRecognizerStateChanged
|
|
59
|
+
gestureRecognizer.view.transform = CGAffineTransformRotate(gestureRecognizer.view.transform, gestureRecognizer.rotation)
|
|
60
|
+
gestureRecognizer.rotation = 0
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def pan_image(gestureRecognizer)
|
|
65
|
+
adjust_anchor_point_for_gesture_recognizer(gestureRecognizer)
|
|
66
|
+
if gestureRecognizer.state == UIGestureRecognizerStateBegan || gestureRecognizer.state == UIGestureRecognizerStateChanged
|
|
67
|
+
translation = gestureRecognizer.translationInView(troll_image_view.superview)
|
|
68
|
+
troll_image_view.center = CGPointMake(troll_image_view.center.x + translation.x, troll_image_view.center.y + translation.y)
|
|
69
|
+
gestureRecognizer.setTranslation(CGPointZero, inView:troll_image_view.superview)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def scale_image(gestureRecognizer)
|
|
74
|
+
adjust_anchor_point_for_gesture_recognizer(gestureRecognizer)
|
|
75
|
+
if gestureRecognizer.state == UIGestureRecognizerStateBegan || gestureRecognizer.state == UIGestureRecognizerStateChanged
|
|
76
|
+
gestureRecognizer.view.transform = CGAffineTransformScale(gestureRecognizer.view.transform, gestureRecognizer.scale, gestureRecognizer.scale)
|
|
77
|
+
gestureRecognizer.scale = 1
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def gestureRecognizer(gestureRecognizer, shouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer)
|
|
82
|
+
true
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def show_source_sheet
|
|
86
|
+
popupQuery = UIActionSheet.alloc.initWithTitle("", delegate:self, cancelButtonTitle:'Cancel', destructiveButtonTitle:nil, otherButtonTitles:"Choose Existing", "Take Picture", nil)
|
|
87
|
+
popupQuery.delegate = self
|
|
88
|
+
popupQuery.actionSheetStyle = UIActionSheetStyleBlackOpaque
|
|
89
|
+
popupQuery.showInView(view)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def actionSheet(actionSheet, clickedButtonAtIndex:buttonIndex)
|
|
93
|
+
case buttonIndex
|
|
94
|
+
when 0
|
|
95
|
+
pick_image
|
|
96
|
+
when 1
|
|
97
|
+
take_image
|
|
98
|
+
when 2
|
|
99
|
+
# cancelled
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def pick_image
|
|
104
|
+
pick_image_with_source(UIImagePickerControllerSourceTypePhotoLibrary)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def take_image
|
|
108
|
+
pick_image_with_source(UIImagePickerControllerSourceTypeCamera)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def pick_image_with_source(source_type)
|
|
112
|
+
# Create and show the image picker.
|
|
113
|
+
imagePicker = UIImagePickerController.alloc.init
|
|
114
|
+
imagePicker.sourceType = source_type
|
|
115
|
+
imagePicker.mediaTypes = [KUTTypeImage]
|
|
116
|
+
imagePicker.delegate = self
|
|
117
|
+
imagePicker.allowsImageEditing = false
|
|
118
|
+
presentModalViewController(imagePicker, animated:true)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# UIImagePickerControllerDelegate methods
|
|
122
|
+
|
|
123
|
+
def imagePickerControllerDidCancel(picker)
|
|
124
|
+
dismissModalViewControllerAnimated(true)
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def imagePickerController(picker, didFinishPickingMediaWithInfo:info)
|
|
128
|
+
mediaType = info[UIImagePickerControllerMediaType]
|
|
129
|
+
if mediaType == KUTTypeImage
|
|
130
|
+
editedImage = info[UIImagePickerControllerEditedImage]
|
|
131
|
+
originalImage = info[UIImagePickerControllerOriginalImage]
|
|
132
|
+
view.image = editedImage || originalImage
|
|
133
|
+
end
|
|
134
|
+
dismissModalViewControllerAnimated(true)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def save_image
|
|
138
|
+
image = view.image
|
|
139
|
+
|
|
140
|
+
troll_image_transform = troll_image_view.transform
|
|
141
|
+
trollfaceRotation = Math.atan2(troll_image_transform.b, troll_image_transform.a)
|
|
142
|
+
trollfaceScaleX = Math.sqrt(troll_image_transform.a**2 + troll_image_transform.c**2)
|
|
143
|
+
trollfaceScaleY = Math.sqrt(troll_image_transform.b**2 + troll_image_transform.d**2)
|
|
144
|
+
|
|
145
|
+
# We are displaying the image in AspectFill mode. This will give us the scale.
|
|
146
|
+
scale = [image.size.width/view.frame.size.width, image.size.height/view.frame.size.height].min
|
|
147
|
+
|
|
148
|
+
targetWidth = image.size.width
|
|
149
|
+
targetHeight = image.size.height
|
|
150
|
+
|
|
151
|
+
# Image Rect and Image Context in the size of the image.
|
|
152
|
+
imageRect = CGRectMake(0, 0, image.size.width, image.size.height)
|
|
153
|
+
|
|
154
|
+
UIGraphicsBeginImageContextWithOptions(CGSizeMake(targetWidth, targetHeight), true, UIScreen.mainScreen.scale)
|
|
155
|
+
c = UIGraphicsGetCurrentContext()
|
|
156
|
+
image.drawInRect(imageRect)
|
|
157
|
+
|
|
158
|
+
# Potential landscape rotation.
|
|
159
|
+
CGContextSaveGState(c)
|
|
160
|
+
|
|
161
|
+
# Get the (possibly rotated) image.
|
|
162
|
+
trollface_image = troll_image_view.image
|
|
163
|
+
if trollfaceRotation != 0
|
|
164
|
+
trollface_image = troll_image_view.image.imageRotatedByRadians(trollfaceRotation)
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Move the context down and left (or either or) to match where the trollface view was on the screen
|
|
168
|
+
CGContextTranslateCTM(c, (image.size.width-view.frame.size.width*scale)/2, (image.size.height-view.frame.size.height*scale)/2)
|
|
169
|
+
# Scale the coordinate context,
|
|
170
|
+
CGContextScaleCTM(c, scale, scale)
|
|
171
|
+
|
|
172
|
+
# Draw the trollface image, correctly scaled.
|
|
173
|
+
trollface_image.drawInRect(CGRectMake(troll_image_view.frame.origin.x, troll_image_view.frame.origin.y, trollface_image.size.width * trollfaceScaleX, trollface_image.size.height * trollfaceScaleY))
|
|
174
|
+
|
|
175
|
+
CGContextRestoreGState(c)
|
|
176
|
+
|
|
177
|
+
newImage = UIGraphicsGetImageFromCurrentImageContext() # UIImage returned
|
|
178
|
+
|
|
179
|
+
UIGraphicsEndImageContext()
|
|
180
|
+
|
|
181
|
+
# Save to camera roll.
|
|
182
|
+
library = ALAssetsLibrary.alloc.init
|
|
183
|
+
library.writeImageToSavedPhotosAlbum(newImage.CGImage, orientation:ALAssetOrientationUp, completionBlock: lambda do |assetURL, error|
|
|
184
|
+
if error
|
|
185
|
+
alert = UIAlertView.alloc.init
|
|
186
|
+
alert.title = "Error When Saving Picture"
|
|
187
|
+
alert.message = error.localizedDescription
|
|
188
|
+
alert.addButtonWithTitle('OK')
|
|
189
|
+
alert.show
|
|
190
|
+
end
|
|
191
|
+
end)
|
|
192
|
+
end
|
|
193
|
+
end
|