ProMotion 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +5 -1
- data/README.md +237 -138
- data/Rakefile +4 -9
- data/app/app_delegate.rb +3 -0
- data/app/screens/basic_screen.rb +27 -0
- data/lib/ProMotion.rb +3 -5
- data/lib/ProMotion/cocoatouch/SplitViewController.rb +25 -0
- data/lib/ProMotion/cocoatouch/TableViewController.rb +5 -5
- data/lib/ProMotion/cocoatouch/ViewController.rb +5 -5
- data/lib/ProMotion/{app_delegate.rb → delegate.rb} +23 -23
- data/lib/ProMotion/helpers/console.rb +6 -4
- data/lib/ProMotion/helpers/logger.rb +73 -0
- data/lib/ProMotion/helpers/view_helper.rb +45 -13
- data/lib/ProMotion/screen_helpers/_tables/_refreshable_table.rb +42 -0
- data/lib/ProMotion/screen_helpers/_tables/_searchable_table.rb +2 -2
- data/lib/ProMotion/screen_helpers/_tables/_sectioned_table.rb +46 -41
- data/lib/ProMotion/screen_helpers/_tables/grouped_table.rb +2 -1
- data/lib/ProMotion/screen_helpers/_tables/plain_table.rb +1 -0
- data/lib/ProMotion/screen_helpers/screen_elements.rb +16 -11
- data/lib/ProMotion/screen_helpers/screen_navigation.rb +15 -16
- data/lib/ProMotion/screen_helpers/screen_tabs.rb +20 -16
- data/lib/ProMotion/screen_helpers/split_screen.rb +42 -0
- data/lib/ProMotion/screens/_screen_module.rb +44 -35
- data/lib/ProMotion/screens/_table_screen_module.rb +18 -1
- data/lib/ProMotion/screens/screen.rb +1 -1
- data/lib/ProMotion/version.rb +1 -1
- data/spec/helpers/table_screen.rb +48 -0
- data/spec/helpers/table_screen_refreshable.rb +11 -0
- data/spec/helpers/table_screen_searchable.rb +5 -0
- data/spec/helpers/test_delegate.rb +9 -0
- data/spec/ios_version_spec.rb +6 -6
- data/spec/logger_spec.rb +68 -0
- data/spec/main_spec.rb +1 -1
- data/spec/screen_helpers_spec.rb +35 -6
- data/spec/{view_controller_spec.rb → screen_spec.rb} +1 -1
- data/spec/split_screen_in_tab_bar_spec.rb +49 -0
- data/spec/split_screen_open_screen_spec.rb +46 -0
- data/spec/split_screen_spec.rb +35 -0
- data/spec/table_screen_spec.rb +72 -0
- data/spec/view_helper_spec.rb +112 -8
- metadata +29 -8
- data/lib/ProMotion/helpers/tab_bar.rb +0 -115
- data/spec/helpers/.gitkeep +0 -0
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ProMotion (0.
|
4
|
+
ProMotion (0.6.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
motion-redgreen (0.1.0)
|
9
10
|
motion-stump (0.2.1)
|
11
|
+
rake (10.0.4)
|
10
12
|
|
11
13
|
PLATFORMS
|
12
14
|
ruby
|
13
15
|
|
14
16
|
DEPENDENCIES
|
15
17
|
ProMotion!
|
18
|
+
motion-redgreen
|
16
19
|
motion-stump
|
20
|
+
rake
|
data/README.md
CHANGED
@@ -1,57 +1,67 @@
|
|
1
|
-
# ProMotion -
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
1
|
+
# ProMotion [![Build Status](https://travis-ci.org/clearsightstudio/ProMotion.png)](https://travis-ci.org/clearsightstudio/ProMotion)
|
2
|
+
|
3
|
+
## A new way to easily build RubyMotion apps.
|
4
|
+
|
5
|
+
ProMotion is a RubyMotion gem that makes iOS development more like Ruby and less like Objective-C.
|
6
|
+
|
7
|
+
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
8
|
+
|
9
|
+
- [ProMotion ](#promotion-)
|
10
|
+
- [A new way to easily build RubyMotion apps.](#a-new-way-to-easily-build-rubymotion-apps)
|
11
|
+
- [Tutorials](#tutorials)
|
12
|
+
- [Screencasts](#screencasts)
|
13
|
+
- [Sample Apps](#sample-apps)
|
14
|
+
- [Apps Built With ProMotion](#apps-built-with-promotion)
|
15
|
+
- [BigDay! Reminder App](#bigday-reminder-app)
|
16
|
+
- [TipCounter App](#tipcounter-app)
|
17
|
+
- [Getting Started](#getting-started)
|
18
|
+
- [Setup](#setup)
|
19
|
+
- [What's New?](#whats-new)
|
20
|
+
- [Version 0.6](#version-06)
|
21
|
+
- [Usage](#usage)
|
22
|
+
- [Creating a basic screen](#creating-a-basic-screen)
|
23
|
+
- [Loading your first screen](#loading-your-first-screen)
|
24
|
+
- [Creating a split screen (iPad apps only)](#creating-a-split-screen-ipad-apps-only)
|
25
|
+
- [Creating a tab bar](#creating-a-tab-bar)
|
26
|
+
- [Add navigation bar buttons](#add-navigation-bar-buttons)
|
27
|
+
- [Opening and closing screens](#opening-and-closing-screens)
|
28
|
+
- [Note about split screens and universal apps](#note-about-split-screens-and-universal-apps)
|
29
|
+
- [Adding view elements](#adding-view-elements)
|
30
|
+
- [Table Screens](#table-screens)
|
31
|
+
- [Using your own UIViewController](#using-your-own-uiviewcontroller)
|
32
|
+
- [Reference](#reference)
|
33
|
+
- [Screen](#screen)
|
34
|
+
- [TableScreen](#tablescreen)
|
35
|
+
- [Logger](#logger)
|
36
|
+
- [Console [deprecated]](#console-deprecated)
|
37
|
+
- [Help](#help)
|
38
|
+
- [Contributing](#contributing)
|
39
|
+
- [Working on Features](#working-on-features)
|
40
|
+
- [Submitting a Pull Request](#submitting-a-pull-request)
|
41
|
+
- [Primary Contributors](#primary-contributors)
|
42
|
+
|
43
|
+
# Tutorials
|
31
44
|
|
32
45
|
http://www.clearsightstudio.com/insights/ruby-motion-promotion-tutorial
|
33
46
|
|
34
|
-
|
35
|
-
|
36
|
-
Video tutorial with 0.4.
|
47
|
+
## Screencasts
|
37
48
|
|
38
49
|
http://www.clearsightstudio.com/insights/tutorial-make-youtube-video-app-rubymotion-promotion/
|
39
50
|
|
40
|
-
|
51
|
+
## Sample Apps
|
41
52
|
|
42
|
-
|
43
|
-
Sample app here: [https://github.com/jamonholmgren/promotion-tutorial](https://github.com/jamonholmgren/promotion-tutorial)
|
53
|
+
[https://github.com/jamonholmgren/promotion-tutorial](https://github.com/jamonholmgren/promotion-tutorial)
|
44
54
|
|
45
|
-
|
55
|
+
## Apps Built With ProMotion
|
46
56
|
|
47
|
-
|
57
|
+
### BigDay! Reminder App
|
48
58
|
Check out the free [BigDay! Reminder app](https://itunes.apple.com/us/app/bigday!/id571756685?ls=1&mt=8) on the
|
49
59
|
App Store to see what's possible. ClearSight Studio built the app for Kijome Software, a small app investment company.
|
50
60
|
|
51
|
-
|
61
|
+
### TipCounter App
|
52
62
|
[TipCounter](http://www.tipcounterapp.com) was built by [Matt Brewer](https://github.com/macfanatic/) for bartenders and servers to easily track their tips. Used ProMotion and the development was a lot of fun!
|
53
63
|
|
54
|
-
|
64
|
+
# Getting Started
|
55
65
|
|
56
66
|
ProMotion is designed to be as intuitive and Ruby-like as possible. For example, here is a
|
57
67
|
typical app folder structure:
|
@@ -68,10 +78,10 @@ typical app folder structure:
|
|
68
78
|
event.rb
|
69
79
|
views/
|
70
80
|
buttons/
|
71
|
-
|
81
|
+
save_event_button.rb
|
72
82
|
app_delegate.rb
|
73
83
|
|
74
|
-
|
84
|
+
## Setup
|
75
85
|
|
76
86
|
Create a new RubyMotion project.
|
77
87
|
|
@@ -93,7 +103,7 @@ Create a Gemfile and add the following lines:
|
|
93
103
|
|
94
104
|
```ruby
|
95
105
|
source 'https://rubygems.org'
|
96
|
-
gem "ProMotion", "~> 0.
|
106
|
+
gem "ProMotion", "~> 0.6.0"
|
97
107
|
```
|
98
108
|
|
99
109
|
Run `bundle install` in Terminal to install ProMotion.
|
@@ -101,7 +111,7 @@ Run `bundle install` in Terminal to install ProMotion.
|
|
101
111
|
Go into your app/app_delegate.rb file and add the following:
|
102
112
|
|
103
113
|
```ruby
|
104
|
-
class AppDelegate < ProMotion::
|
114
|
+
class AppDelegate < ProMotion::Delegate
|
105
115
|
def on_load(app, options)
|
106
116
|
open HomeScreen.new(nav_bar: true)
|
107
117
|
end
|
@@ -116,8 +126,10 @@ Now drop in this code:
|
|
116
126
|
class HomeScreen < ProMotion::Screen
|
117
127
|
title "Home"
|
118
128
|
|
119
|
-
def
|
120
|
-
self.view
|
129
|
+
def will_appear
|
130
|
+
set_attributes self.view, {
|
131
|
+
backgroundColor: UIColor.whiteColor
|
132
|
+
}
|
121
133
|
end
|
122
134
|
end
|
123
135
|
```
|
@@ -128,42 +140,23 @@ Run `rake`. You should now see the simulator open with your home screen and a na
|
|
128
140
|
![ProMotion Home Screen](http://clearsightstudio.github.com/ProMotion/img/ProMotion/home-screen.png)
|
129
141
|
|
130
142
|
|
131
|
-
|
132
|
-
|
133
|
-
### Version 0.5
|
134
|
-
|
135
|
-
Version 0.5 is mostly a documentation and consistency release. It should be backwards-compatible
|
136
|
-
with 0.4.
|
143
|
+
# What's New?
|
137
144
|
|
138
|
-
|
139
|
-
* Added tests ... run with `rake spec` (thanks [@macfanatic](http://twitter.com/macfanatic))
|
140
|
-
* Rearranged internal folders to make a lot more sense
|
141
|
-
* More complete API documentation
|
142
|
-
* Refactored camelCase methods and configs to under_score
|
143
|
-
* Set `should_autorotate` to true by default
|
144
|
-
* Changed `open_screen` to `open` (`open_screen` still works for backwards compatibility)
|
145
|
-
* `add_element` is now `add` (and `remove_element` is `remove`)
|
146
|
-
* Removed built-in app (will release some sample apps soon, including a "Kitchen Sink" one)
|
145
|
+
## Version 0.6
|
147
146
|
|
148
|
-
|
147
|
+
* Will auto-detect if you've loaded [motion-xray](https://github.com/colinta/motion-xray) and enable it.
|
148
|
+
* Added `open_split_screen` for iPad-supported apps (thanks @rheoli for your contributions to this)
|
149
|
+
* Added `refreshable` to TableScreens (thanks to @markrickert) for pull-to-refresh support.
|
150
|
+
* `ProMotion::AppDelegateParent` renamed to `ProMotion::Delegate` (`AppDelegateParent` is an alias)
|
151
|
+
* `set_attributes` and `add` now apply nested attributes recursively
|
152
|
+
* `set_attributes` and `add` now accept snake_case instead of camelCase methods (e.g., background_color)
|
153
|
+
* Added `add_to` method for adding views to any parent view. `remove` works with this normally.
|
154
|
+
* Deprecated Console.log and replaced with PM::Logger
|
155
|
+
* Many improvements to how screens and navigation controllers are loaded, tests
|
149
156
|
|
150
|
-
|
151
|
-
* Screen functionality can also be inherited as a module in your own UIViewController, but you need to provide your own methods for viewDidLoad and whatnot.
|
152
|
-
* Tons of headlessCamelCaps methods are now properly_ruby_underscored (with an alias to the old name for compatibility)
|
153
|
-
* `open_screen` and `close_screen` can now just be `open` and `close` respectively
|
154
|
-
* Attempted to keep 100% compatibility with 0.3.x but no guarantees...report issues, please!
|
155
|
-
* Revamped the internal folder structure of the gem...more work on this to come
|
156
|
-
* Built in a few helpers that were external before, like `content_height(view)`
|
157
|
-
* More consistent calling of `on_load` (sometimes doesn't get called in 0.3.x)
|
158
|
-
* `fresh_start SomeScreen` is now `open_root_screen SomeScreen`
|
159
|
-
* Removed `set_view_controller` as we don't need it anymore
|
160
|
-
* Better documentation (still needs work), better error messages
|
161
|
-
* Deprecation warnings EVERYWHERE for older apps (upgrade already!)
|
157
|
+
# Usage
|
162
158
|
|
163
|
-
|
164
|
-
## Usage
|
165
|
-
|
166
|
-
### Creating a basic screen
|
159
|
+
## Creating a basic screen
|
167
160
|
|
168
161
|
```ruby
|
169
162
|
class HomeScreen < ProMotion::Screen
|
@@ -184,18 +177,29 @@ class HomeScreen < ProMotion::Screen
|
|
184
177
|
end
|
185
178
|
```
|
186
179
|
|
187
|
-
|
180
|
+
## Loading your first screen
|
188
181
|
|
189
182
|
```ruby
|
190
|
-
# In
|
191
|
-
class AppDelegate < ProMotion::
|
183
|
+
# In app/app_delegate.rb
|
184
|
+
class AppDelegate < ProMotion::Delegate
|
192
185
|
def on_load(app, options)
|
193
186
|
open MyHomeScreen.new(nav_bar: true)
|
194
187
|
end
|
195
188
|
end
|
196
189
|
```
|
197
190
|
|
198
|
-
|
191
|
+
## Creating a split screen (iPad apps only)
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
# In app/app_delegate.rb
|
195
|
+
class AppDelegate < ProMotion::Delegate
|
196
|
+
def on_load(app, options)
|
197
|
+
open_split_screen MenuScreen, DetailScreen
|
198
|
+
end
|
199
|
+
end
|
200
|
+
```
|
201
|
+
|
202
|
+
## Creating a tab bar
|
199
203
|
|
200
204
|
Creating a tabbed bar with multiple screens. This will set the tab bar as the root view controller for your app,
|
201
205
|
so keep that in mind. It can be done from the AppDelegate#on_load or from a screen (that screen will go away, though).
|
@@ -230,7 +234,7 @@ def some_action
|
|
230
234
|
end
|
231
235
|
```
|
232
236
|
|
233
|
-
|
237
|
+
## Add navigation bar buttons
|
234
238
|
|
235
239
|
These two methods add the buttons to the top navigation bar of a screen. The `action:` lets you specify a method to
|
236
240
|
call when that button is tapped, and you can pass in a UIBarButton style using `type:`.
|
@@ -240,7 +244,7 @@ set_nav_bar_right_button "Save", action: :save_something, type: UIBarButtonItemS
|
|
240
244
|
set_nav_bar_left_button "Cancel", action: :return_to_some_other_screen, type: UIBarButtonItemStylePlain
|
241
245
|
```
|
242
246
|
|
243
|
-
|
247
|
+
## Opening and closing screens
|
244
248
|
|
245
249
|
If the user taps something and you want to open a new screen, it's easy. Just use `open` and pass in the screen class
|
246
250
|
or an instance of that screen.
|
@@ -314,16 +318,40 @@ class MainScreen < ProMotion::Screen
|
|
314
318
|
end
|
315
319
|
```
|
316
320
|
|
317
|
-
###
|
321
|
+
### Note about split screens and universal apps
|
322
|
+
|
323
|
+
It's common to want to open a screen in the same navigation controller if on iPhone but
|
324
|
+
in a separate detail view when on iPad. Here's a good way to do that.
|
325
|
+
|
326
|
+
```ruby
|
327
|
+
class MenuScreen < ProMotion::TableScreen
|
328
|
+
# ...
|
329
|
+
def some_action
|
330
|
+
open SomeScreen.new, in_detail: true
|
331
|
+
end
|
332
|
+
end
|
333
|
+
```
|
334
|
+
|
335
|
+
The `in_detail` option tells ProMotion to look for a split screen and open in the detail screen
|
336
|
+
if it's available. If not, open normally. This also works for `in_master:`.
|
337
|
+
|
338
|
+
## Adding view elements
|
318
339
|
|
319
340
|
Any view item (UIView, UIButton, custom UIView subclasses, etc) can be added to the current view with `add`.
|
320
341
|
`add` accepts a second argument which is a hash of attributes that get applied to the element before it is
|
321
342
|
dropped into the view.
|
322
343
|
|
344
|
+
`add(view, attr={})`
|
345
|
+
|
323
346
|
```ruby
|
324
|
-
@label = add UILabel.
|
347
|
+
@label = add UILabel.new, {
|
325
348
|
text: "This is awesome!",
|
326
|
-
font: UIFont.systemFontOfSize(18)
|
349
|
+
font: UIFont.systemFontOfSize(18),
|
350
|
+
resize: [ :left, :right, :top, :bottom, :width, :height ], # autoresizingMask
|
351
|
+
left: 5, # These four attributes are used with CGRectMake
|
352
|
+
top: 5,
|
353
|
+
width: 20,
|
354
|
+
height: 20
|
327
355
|
}
|
328
356
|
|
329
357
|
@element = add UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), {
|
@@ -332,14 +360,29 @@ dropped into the view.
|
|
332
360
|
```
|
333
361
|
|
334
362
|
The `set_attributes` method is identical to add except that it does not add it to the current view.
|
363
|
+
If you use snake_case and there isn't an existing method, it'll try camelCase. This allows you to
|
364
|
+
use snake_case for Objective-C methods.
|
365
|
+
|
366
|
+
`set_attributes(view, attr={})`
|
335
367
|
|
336
368
|
```ruby
|
337
369
|
@element = set_attributes UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), {
|
370
|
+
# `background_color` is translated to `backgroundColor` automatically.
|
371
|
+
background_color: UIColor.whiteColor
|
372
|
+
}
|
373
|
+
```
|
374
|
+
|
375
|
+
You can use `add_to` to add a view to any other view, not just the main view.
|
376
|
+
|
377
|
+
`add_to(parent_view, new_view, attr={})`
|
378
|
+
|
379
|
+
```ruby
|
380
|
+
add_to @some_parent_view, UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), {
|
338
381
|
backgroundColor: UIColor.whiteColor
|
339
382
|
}
|
340
383
|
```
|
341
384
|
|
342
|
-
|
385
|
+
## Table Screens
|
343
386
|
|
344
387
|
You can create sectioned table screens easily with TableScreen, SectionedTableScreen, and GroupedTableScreen.
|
345
388
|
|
@@ -398,7 +441,7 @@ your Rakefile and doing this:
|
|
398
441
|
]
|
399
442
|
```
|
400
443
|
|
401
|
-
|
444
|
+
## Using your own UIViewController
|
402
445
|
|
403
446
|
Sometimes you want to inherit from a different UIViewController other than that provided by ProMotion,
|
404
447
|
such as when using [Formotion](https://github.com/clayallsopp/formotion). **RubyMotion doesn't currently
|
@@ -456,9 +499,9 @@ class EventsScreen < Formotion::FormController # Can also be < UIViewController
|
|
456
499
|
end
|
457
500
|
```
|
458
501
|
|
459
|
-
|
502
|
+
# Reference
|
460
503
|
|
461
|
-
|
504
|
+
## Screen
|
462
505
|
|
463
506
|
<table>
|
464
507
|
<tr>
|
@@ -609,36 +652,6 @@ end
|
|
609
652
|
Returns the iOS version that is running on the device<br />
|
610
653
|
</td>
|
611
654
|
</tr>
|
612
|
-
<tr>
|
613
|
-
<td>ios_version_greater?(version)</td>
|
614
|
-
<td>
|
615
|
-
Returns true if 'ios_version' is greater than the version passed in, false otherwise<br />
|
616
|
-
</td>
|
617
|
-
</tr>
|
618
|
-
<tr>
|
619
|
-
<td>ios_version_greater_eq?(version)</td>
|
620
|
-
<td>
|
621
|
-
Returns true if 'ios_version' is greater than or equal to the version passed in, false otherwise<br />
|
622
|
-
</td>
|
623
|
-
</tr>
|
624
|
-
<tr>
|
625
|
-
<td>ios_version_is?(version)</td>
|
626
|
-
<td>
|
627
|
-
Returns true if 'ios_version' is equal to the version passed in, false otherwise<br />
|
628
|
-
</td>
|
629
|
-
</tr>
|
630
|
-
<tr>
|
631
|
-
<td>ios_version_less?(version)</td>
|
632
|
-
<td>
|
633
|
-
Returns true if 'ios_version' is less than the version passed in, false otherwise<br />
|
634
|
-
</td>
|
635
|
-
</tr>
|
636
|
-
<tr>
|
637
|
-
<td>ios_version_less_eq?(version)</td>
|
638
|
-
<td>
|
639
|
-
Returns true if 'ios_version' is less than or equal to the version passed in, false otherwise<br />
|
640
|
-
</td>
|
641
|
-
</tr>
|
642
655
|
<tr>
|
643
656
|
<td>app_delegate</td>
|
644
657
|
<td>
|
@@ -662,19 +675,26 @@ end
|
|
662
675
|
<td>
|
663
676
|
Pushes the screen onto the navigation stack or opens in a modal<br />
|
664
677
|
Argument options:<br />
|
665
|
-
<code>nav_bar: true|false</code
|
678
|
+
<code>nav_bar: true|false</code><br />
|
666
679
|
<code>hide_tab_bar: true|false</code><br />
|
667
680
|
<code>modal: true|false</code><br />
|
668
|
-
<code>close_all: true|false</code> (closes all open screens and opens as root)<br />
|
681
|
+
<code>close_all: true|false</code> (closes all open screens and opens as root...same as open_root_screen)<br />
|
669
682
|
<code>animated: true:false</code> (currently only affects modals)<br />
|
670
683
|
<code>in_tab: "Tab name"</code> (if you're in a tab bar)<br />
|
671
|
-
|
684
|
+
Any accessors in <code>screen</code> can also be set in this hash.
|
685
|
+
</td>
|
686
|
+
</tr>
|
687
|
+
<tr>
|
688
|
+
<td>open_split_screen(master, detail)</td>
|
689
|
+
<td>
|
690
|
+
*iPad apps only*
|
691
|
+
Opens a UISplitScreenViewController with the specified screens as the root view controller of the current app<br />
|
672
692
|
</td>
|
673
693
|
</tr>
|
674
694
|
<tr>
|
675
695
|
<td>open_tab_bar(*screens)</td>
|
676
696
|
<td>
|
677
|
-
|
697
|
+
Opens a UITabBarController with the specified screens as the root view controller of the current app<br />
|
678
698
|
</td>
|
679
699
|
</tr>
|
680
700
|
<tr>
|
@@ -685,7 +705,7 @@ end
|
|
685
705
|
</tr>
|
686
706
|
</table>
|
687
707
|
|
688
|
-
|
708
|
+
## TableScreen
|
689
709
|
|
690
710
|
*Has all the methods of Screen*
|
691
711
|
|
@@ -694,14 +714,26 @@ end
|
|
694
714
|
<th>Method</th>
|
695
715
|
<th>Description</th>
|
696
716
|
</tr>
|
697
|
-
<tr>
|
698
|
-
<td>self</td>
|
699
|
-
<td>Returns the current UITableViewController (not UITableView)</td>
|
700
|
-
</tr>
|
701
717
|
<tr>
|
702
718
|
<td>searchable(placeholder: "placeholder text")</td>
|
703
719
|
<td>Class method to make the current table searchable.</td>
|
704
720
|
</tr>
|
721
|
+
<tr>
|
722
|
+
<td><pre><code>refreshable(
|
723
|
+
callback: :on_refresh,
|
724
|
+
pull_message: "Pull to refresh",
|
725
|
+
refreshing: "Refreshing data…",
|
726
|
+
updated_format: "Last updated at %s",
|
727
|
+
updated_time_format: "%l:%M %p"
|
728
|
+
)</code></pre></td>
|
729
|
+
<td>Class method to make the current table refreshable.
|
730
|
+
<p>All parameters are optional. If you do not specify a a callback, it will assume you've implemented an <code>on_refresh</code> method in your tableview.</p>
|
731
|
+
<pre><code>def on_refresh
|
732
|
+
# Code to start the refresh
|
733
|
+
end</code></pre>
|
734
|
+
<p>And after you're done with your asyncronous process, call <code>end_refreshing</code> to collapse the refresh view and update the last refreshed time and then <code>update_table_data</code>.</p></td>
|
735
|
+
<img src="https://f.cloud.github.com/assets/139261/472574/af268e52-b735-11e2-8b9b-a9245b421715.gif" />
|
736
|
+
</tr>
|
705
737
|
<tr>
|
706
738
|
<td colspan="2">
|
707
739
|
<h3>table_data</h3>
|
@@ -727,6 +759,7 @@ def table_data
|
|
727
759
|
subtitle: "This is way too huge..see note",
|
728
760
|
arguments: { data: [ "lots", "of", "data" ] },
|
729
761
|
action: :tapped_cell_1,
|
762
|
+
height: 50, # manually changes the cell's height
|
730
763
|
cell_style: UITableViewCellStyleSubtitle,
|
731
764
|
cell_identifier: "Cell",
|
732
765
|
cell_class: ProMotion::TableViewCell,
|
@@ -769,7 +802,60 @@ end
|
|
769
802
|
</tr>
|
770
803
|
</table>
|
771
804
|
|
772
|
-
|
805
|
+
## Logger
|
806
|
+
|
807
|
+
*Accessible from ProMotion.logger or PM.logger ... you can also set a new logger by setting `PM.logger = MyLogger.new`*
|
808
|
+
|
809
|
+
<table>
|
810
|
+
<tr>
|
811
|
+
<th>Method</th>
|
812
|
+
<th>Description</th>
|
813
|
+
</tr>
|
814
|
+
<tr>
|
815
|
+
<td>log(label, message_text, color)</td>
|
816
|
+
<td>
|
817
|
+
Output a colored console message.<br />
|
818
|
+
Example: <code>PM.logger.log("TESTING", "This is red!", :red)</code>
|
819
|
+
</td>
|
820
|
+
</tr>
|
821
|
+
<tr>
|
822
|
+
<td>error(message)</td>
|
823
|
+
<td>
|
824
|
+
Output a red colored console error.<br />
|
825
|
+
Example: <code>PM.logger.error("This is an error")</code>
|
826
|
+
</td>
|
827
|
+
</tr>
|
828
|
+
<tr>
|
829
|
+
<td>deprecated(message)</td>
|
830
|
+
<td>
|
831
|
+
Output a yellow colored console deprecated.<br />
|
832
|
+
Example: <code>PM.logger.deprecated("This is a deprecation warning.")</code>
|
833
|
+
</td>
|
834
|
+
</tr>
|
835
|
+
<tr>
|
836
|
+
<td>warn(message)</td>
|
837
|
+
<td>
|
838
|
+
Output a yellow colored console warning.<br />
|
839
|
+
Example: <code>PM.logger.warn("This is a warning")</code>
|
840
|
+
</td>
|
841
|
+
</tr>
|
842
|
+
<tr>
|
843
|
+
<td>debug(message)</td>
|
844
|
+
<td>
|
845
|
+
Output a purple colored console debug message.<br />
|
846
|
+
Example: <code>PM.logger.debug(@some_var)</code>
|
847
|
+
</td>
|
848
|
+
</tr>
|
849
|
+
<tr>
|
850
|
+
<td>info(message)</td>
|
851
|
+
<td>
|
852
|
+
Output a green colored console info message.<br />
|
853
|
+
Example: <code>PM.logger.info("This is an info message")</code>
|
854
|
+
</td>
|
855
|
+
</tr>
|
856
|
+
</table>
|
857
|
+
|
858
|
+
## Console [deprecated]
|
773
859
|
|
774
860
|
<table>
|
775
861
|
<tr>
|
@@ -777,7 +863,9 @@ end
|
|
777
863
|
<th>Description</th>
|
778
864
|
</tr>
|
779
865
|
<tr>
|
780
|
-
<td>log(log, with_color:color)
|
866
|
+
<td>log(log, with_color:color)<br />
|
867
|
+
[DEPRECATED] -- use Logger
|
868
|
+
</td>
|
781
869
|
<td>
|
782
870
|
Class method to output a colored console message.<br />
|
783
871
|
Example: <code>ProMotion::Console.log("This is red!", with_color: ProMotion::Console::RED_COLOR)</code>
|
@@ -785,15 +873,25 @@ end
|
|
785
873
|
</tr>
|
786
874
|
</table>
|
787
875
|
|
788
|
-
|
876
|
+
# Help
|
877
|
+
|
878
|
+
If you need help, feel free to ping me on twitter @jamonholmgren or open a ticket on GitHub.
|
879
|
+
Opening a ticket is usually the best and we respond to those pretty quickly.
|
880
|
+
|
881
|
+
# Contributing
|
789
882
|
|
790
|
-
|
883
|
+
I'm very open to ideas. Tweet me with your ideas or open a ticket (I don't mind!)
|
884
|
+
and let's discuss.
|
791
885
|
|
792
|
-
##
|
886
|
+
## Working on Features
|
793
887
|
|
794
|
-
|
888
|
+
1. Clone the repos into `Your-Project/Vendor/ProMotion`
|
889
|
+
2. Update your `Gemfile`to reference the project as `gem 'ProMotion', :path => "vendor/ProMotion/"`
|
890
|
+
3. Run `bundle`
|
891
|
+
4. Run `rake clean` and then `rake`
|
892
|
+
5. Contribute!
|
795
893
|
|
796
|
-
|
894
|
+
## Submitting a Pull Request
|
797
895
|
|
798
896
|
1. Fork the project
|
799
897
|
2. Create a feature branch
|
@@ -801,8 +899,9 @@ I'm really looking for feedback. Tweet me with your ideas or open a ticket (I do
|
|
801
899
|
4. Update or create new specs
|
802
900
|
5. Make sure tests are passing by running `rake spec`
|
803
901
|
6. Submit pull request
|
902
|
+
7. Fame, adoration, kudos everywhere
|
804
903
|
|
805
|
-
|
904
|
+
## Primary Contributors
|
806
905
|
|
807
906
|
* Jamon Holmgren: [@jamonholmgren](https://twitter.com/jamonholmgren)
|
808
907
|
* Silas Matson: [@silasjmatson](https://twitter.com/silasjmatson)
|