teacup 0.0.1.pre → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/.gitignore +5 -3
  2. data/CHANGES.md +26 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +1 -1
  5. data/LICENSE +26 -0
  6. data/README.md +383 -95
  7. data/Rakefile +8 -36
  8. data/app/app_delegate.rb +14 -0
  9. data/app/controllers/first_controller.rb +71 -0
  10. data/app/controllers/landscape_only_controller.rb +16 -0
  11. data/app/controllers/tableview_controller.rb +0 -0
  12. data/app/styles/main_styles.rb +111 -0
  13. data/app/views/custom_view.rb +4 -0
  14. data/lib/dummy.rb +56 -0
  15. data/lib/teacup/handler.rb +99 -0
  16. data/lib/teacup/layout.rb +22 -74
  17. data/lib/teacup/merge_defaults.rb +45 -0
  18. data/lib/teacup/style.rb +93 -0
  19. data/lib/teacup/stylesheet.rb +242 -0
  20. data/lib/teacup/stylesheet_extensions/rotation.rb +38 -0
  21. data/lib/teacup/version.rb +1 -1
  22. data/lib/teacup/z_core_extensions/ca_layer.rb +6 -0
  23. data/lib/teacup/z_core_extensions/ui_view.rb +119 -0
  24. data/lib/teacup/z_core_extensions/ui_view_controller.rb +179 -0
  25. data/lib/teacup/z_core_extensions/ui_view_getters.rb +34 -0
  26. data/lib/teacup/z_core_extensions/z_handlers.rb +57 -0
  27. data/lib/teacup.rb +16 -33
  28. data/samples/Hai/Rakefile +7 -2
  29. data/samples/Hai/app/app_delegate.rb +2 -2
  30. data/samples/Hai/app/hai_controller.rb +8 -4
  31. data/samples/Hai/styles/iphone.rb +40 -0
  32. data/spec/main_spec.rb +226 -0
  33. data/spec/style_spec.rb +171 -0
  34. data/spec/stylesheet_spec.rb +348 -0
  35. data/spec/view_spec.rb +103 -0
  36. data/teacup.gemspec +13 -13
  37. metadata +47 -46
  38. data/.rspec +0 -2
  39. data/lib/teacup/contributors.rb +0 -7
  40. data/lib/teacup/core_extensions/ui_view.rb +0 -4
  41. data/lib/teacup/core_extensions/ui_view_controller.rb +0 -62
  42. data/lib/teacup/style_sheet.rb +0 -195
  43. data/lib/teacup/view.rb +0 -123
  44. data/pkg/teacup-0.0.0.gem +0 -0
  45. data/pkg/teacup-0.0.1.gem +0 -0
  46. data/proposals/other/README.md +0 -45
  47. data/proposals/other/app/config/application.rb +0 -1
  48. data/proposals/other/app/config/boot.rb +0 -1
  49. data/proposals/other/app/config/initializers/twitter.rb +0 -7
  50. data/proposals/other/app/controllers/events_controller.rb +0 -28
  51. data/proposals/other/app/controllers/venues_controller.rb +0 -4
  52. data/proposals/other/app/db/README.md +0 -16
  53. data/proposals/other/app/db/migrations/20120514201043_create_events.rb +0 -9
  54. data/proposals/other/app/db/migrations/20120514201044_add_price_to_events.rb +0 -5
  55. data/proposals/other/app/db/migrations/20120514201045_create_venues.rb +0 -8
  56. data/proposals/other/app/db/schema.rb +0 -19
  57. data/proposals/other/app/models/event.rb +0 -14
  58. data/proposals/other/app/models/venue.rb +0 -3
  59. data/proposals/other/app/views/events/edit.ipad.rb +0 -8
  60. data/proposals/other/app/views/events/edit.iphone.rb +0 -7
  61. data/proposals/other/app/views/events/show.ipad.rb +0 -2
  62. data/proposals/other/app/views/events/show.iphone.rb +0 -3
  63. data/samples/Hai/styles/ipad.rb +0 -11
  64. data/samples/Hai/styles/ipad_vertical.rb +0 -3
  65. data/spec/spec_helper.rb +0 -5
  66. data/spec/teacup/contributions_spec.rb +0 -13
  67. data/spec/teacup/version_spec.rb +0 -9
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
- .DS_Store
2
- .rspec
3
- .sass-cache/
1
+ .repl_history
2
+ build
3
+ resources/*.nib
4
+ resources/*.momd
5
+ resources/*.storyboardc
data/CHANGES.md ADDED
@@ -0,0 +1,26 @@
1
+ v0.2.0
2
+ ------
3
+
4
+ - Stylesheets are no longer constants. Instead, they can be fetched by name: `Teacup::Stylesheet[:iphone]`
5
+ - Stylesheets can be assigned by calling the `stylesheet :stylesheet_name` inside a view controller.
6
+ - Ability to style based on view class.
7
+ - Support for orientation-based styles.
8
+
9
+
10
+ v0.1.0
11
+ ------
12
+
13
+ Working code! Uses finalized proposal, but changes are still happenin'.
14
+
15
+ v0.0.0
16
+ ------
17
+
18
+ Proposals. They have been merged into a finalized proposal, based mostly on
19
+ ConradIrwin's stylesheets and a declaritive layout DSL that emerged from
20
+ discussions
21
+
22
+ embryo
23
+ ------
24
+
25
+ It will be known as "teacup".
26
+
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source :rubygems
2
2
 
3
+ gem 'teacup', :path => '.'
4
+
3
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- teacup (0.0.1)
4
+ teacup (0.3.0)
5
5
  rake
6
6
 
7
7
  GEM
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2012, rubymotion community
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
+
24
+ The views and conclusions contained in the software and documentation are those
25
+ of the authors and should not be interpreted as representing official policies,
26
+ either expressed or implied, of the Teacup Project.
data/README.md CHANGED
@@ -3,55 +3,81 @@ Teacup
3
3
 
4
4
  A community-driven DSL for creating user interfaces on the iphone.
5
5
 
6
- By including the `Teacup` module, you can easily create layouts that adhere to
7
- the [iOS user interface guidelines][iOS HIG], and it's an easy way to assign labels,
8
- delegators, and datasources.
6
+ Using teacup, you can easily create and style layouts while keeping your code
7
+ dry. The goal is to offer a rubyesque (well, actually a rubymotion-esque) way
8
+ to create interfaces programmatically.
9
9
 
10
- The goal is not to simply rename CocoaTouch method names, but to offer a
11
- rubyesque (well, actually a rubymotion-esque) way to create an interface.
10
+ **Check out a working sample app [here][Hai]!**
12
11
 
13
- Using stylesheets and layouts, it makes coding an iOS app like designing a website with HTML and CSS.
14
-
15
- **Check out a working sample app [here](https://github.com/rubymotion/teacup/tree/master/samples/Hai)!**
12
+ [Hai]: https://github.com/rubymotion/teacup/tree/master/samples/Hai
16
13
 
17
14
  #### Installation
18
15
 
16
+ First get the teacup library into your local project using git submodules:
17
+
19
18
  ```bash
20
- $ git submodule add https://github.com:rubymotion/teacup vendor/teacup
19
+ $ git submodule add https://github.com/rubymotion/teacup vendor/teacup
21
20
  ```
22
21
 
23
22
  Then add the teacup library to your Rakefile:
24
- ```
25
- # Add libraries *before* your app so that you can access constants they define safely
26
- #
27
- dirs = ['vendor/teacup/lib', 'app']
28
23
 
29
- # require all the directories in order.
30
- app.files = dirs.map{|d| Dir.glob(File.join(app.project_dir, "#{d}/**/*.rb")) }.flatten
24
+ ```
25
+ Motion::Project::App.setup do |app|
26
+ # ...
27
+ app.files.unshift(*Dir['vendor/teacup/lib/**/*.rb'])
28
+ end
31
29
  ```
32
30
 
31
+ You can run the test suite or compile the test app:
32
+
33
+ ```bash
34
+ $ cd vendor/teacup
35
+ $ rake spec # or just rake, to run the app.
36
+ ```
33
37
 
34
38
  #### Showdown
35
39
 
36
- Regular
40
+ Cocoa
37
41
 
38
42
  ```ruby
39
43
  class SomeController < UIViewController
40
- def viewDidLoad
41
-
42
- @field = UITextField.new
43
- @field.height = 50
44
- @field.width = 200
45
- view.addSubview(@field)
46
-
47
- @search = UITextField.new
48
- @search.height = 50
49
- @search.width = 200
50
- @search.placeholder = 'Find something...'
51
- view.addSubview(@search)
52
-
53
- true
54
- end
44
+
45
+ def viewDidLoad
46
+
47
+ @field = UITextField.new
48
+ @field.frame = [[10, 10], [200, 50]]
49
+ @search.textColor = UIColor.redColor
50
+ view.addSubview(@field)
51
+
52
+ @search = UITextField.new
53
+ @search.frame = [[10, 70], [200, 50]]
54
+ @search.placeholder = 'Find something...'
55
+ @search.textColor = UIColor.redColor
56
+ view.addSubview(@search)
57
+
58
+ true
59
+ end
60
+
61
+ # code to enable orientation changes
62
+ def shouldAutorotateToInterfaceOrientation(orientation)
63
+ if orientation == UIDeviceOrientationPortraitUpsideDown
64
+ return false
65
+ end
66
+ true
67
+ end
68
+
69
+ # perform the frame changes depending on orientation
70
+ def willAnimateRotationToInterfaceOrientation(orientation, duration:duration)
71
+ case orientation
72
+ when UIDeviceOrientationLandscapeLeft, UIDeviceOrientationLandscapeRight
73
+ @field.frame = [[10, 10], [360, 50]]
74
+ @search.frame = [[10, 70], [360, 50]]
75
+ else
76
+ @field.frame = [[10, 10], [200, 50]]
77
+ @search.frame = [[10, 70], [200, 50]]
78
+ end
79
+ end
80
+
55
81
  end
56
82
  ```
57
83
 
@@ -60,92 +86,354 @@ Teacup
60
86
  ```ruby
61
87
  # Stylesheet
62
88
 
63
- Teacup::StyleSheet.new(:IPhone) do
64
-
65
- style :field,
66
- height: 50,
67
- width: 200
68
-
69
- style :search, extends: :field,
70
- placeholder: 'Foo...'
71
-
89
+ Teacup::Stylesheet.new(:some_view) do
90
+
91
+ style :root,
92
+ landscape: true # enable landscape rotation (otherwise only portrait is enabled)
93
+ # this must be on the root-view, to indicate that this view is
94
+ # capable of handling rotations
95
+
96
+ style :field,
97
+ left: 10,
98
+ top: 10,
99
+ width: 200,
100
+ height: 50,
101
+ landscape: {
102
+ width: 360 # make it wide in landscape view
103
+ }
104
+
105
+ style :search, extends: :field,
106
+ left: 10,
107
+ top: 70,
108
+ placeholder: 'Find something...'
109
+
110
+ style UITextField, # Defining styles based on view class instead
111
+ textColor: UIColor.redColor # of style name.
112
+
72
113
  end
73
114
 
74
115
  # Controller
75
116
 
76
117
  class SomeController < UIViewController
77
-
78
- def viewDidLoad
79
- view.addSubview(Teacup.style(:field, UITextField.new))
80
- view.addSubview(Teacup.style(:search))
81
- true
82
- end
83
-
118
+
119
+ # the stylesheet determines the placement and design of your views. You can
120
+ # also implement a stylesheet method, or assign the stylesheet name to the
121
+ # UIViewController later.
122
+ stylesheet :some_view
123
+
124
+ # think of this as a nib file that you are declaring in your UIViewController.
125
+ # it is styled according to the :root styles, and can add and style subviews
126
+ layout :root do
127
+ subview(UITextField, :field)
128
+ @search = subview(UITextField, :search)
129
+ end
130
+
131
+ # you have to enable the auto-rotation stuff by implementing a
132
+ # shouldAutorotateToInterfaceOrientation method
133
+ def shouldAutorotateToInterfaceOrientation(orientation)
134
+ # but don't worry, we made that painless, too!
135
+ autorotateToOrientation(orientation)
136
+ end
137
+
138
+ end
139
+ ```
140
+
141
+ The orientation styling is really neat. I think you'll find that you will be
142
+ more inspired to enable multiple orientations because the code is so much more
143
+ painless.
144
+
145
+ Stylesheets
146
+ -----------
147
+
148
+ The basic format for a `style` is a name and a dictionary of "styles". These
149
+ are usually just methods that get called on the target (a `UIView` or `CALayer`,
150
+ most likely), but they can also perform introspection, using "handlers".
151
+
152
+ Basics
153
+ ======
154
+
155
+ Create a stylesheet in any code file, usually `styles.rb` or `styles/main.rb`,
156
+ if you have a ton of 'em. The `Teacup::Stylesheet` constructor accepts a
157
+ stylesheet name and a block, which will contain your style declarations.
158
+
159
+ ```ruby
160
+ Teacup::Stylesheet.new :main_menu do
161
+ style :ready_to_play_button,
162
+ backgroundColor: UIColor.blackColor,
163
+ frame: [[20, 300], [50, 20]] # [[x, y], [w, h]]
84
164
  end
85
165
  ```
86
166
 
167
+ Any method that accepts a single value can be assigned here. Please don't abuse
168
+ this by hiding application logic in your stylesheets - these are meant for
169
+ *design*, not behavior. That said, if you're coding by yourself - go for it! ;)
170
+
171
+ Orientations
172
+ ============
173
+
174
+ Teacup stylesheets can be given orientation hashes. The supported orientations
175
+ are:
176
+
177
+ - `portrait` - upright or upside down
178
+ - `upside_up`
179
+ - `upside_down`
180
+ - `landscape` - on either side
181
+ - `landscape_left` - "left" refers to the home button, e.g. the button is on the left.
182
+ - `landscape_right` - home button is on the right
183
+
184
+ An example should suffice:
185
+
186
+ ```ruby
187
+ style :ready_to_play_button,
188
+ portrait: {
189
+ frame: [[20, 300], [50, 20]]
190
+ },
191
+ landscape: {
192
+ frame: [[60, 300], [50, 20]] # button moves over 40 pixels because of the wider screen
193
+ }
194
+ ```
195
+
196
+ That code is repetive, though, let's shorten it up by using precedence and some
197
+ aliases for setting the `frame`:
198
+
199
+ ```ruby
200
+ style :ready_to_play_button,
201
+ top: 300,
202
+ width: 50,
203
+ height: 20,
204
+ portrait: {
205
+ left: 20
206
+ },
207
+ landscape: {
208
+ left: 60
209
+ }
210
+ ```
211
+
212
+ Styles declared in an orientation hash will override the "generic" styles
213
+ declared directly above it, so the above could also be written as:
214
+
215
+ ```ruby
216
+ style :ready_to_play_button,
217
+ top: 300,
218
+ width: 50,
219
+ height: 20,
220
+ left: 20
221
+ landscape: {
222
+ left: 60 # overrides left: 20
223
+ }
224
+ ```
225
+
226
+ Handlers
227
+ ========
228
+
229
+ Above, we saw that we can assign `view.frame.x` by using the `left` property.
230
+ There *is* no `UIView#left` method, so this must be handled somewhere special...
231
+
232
+ Not **that** special, it turns out. This used to be an internal translation,
233
+ but the list of "translations" was getting out of hand, and we realized that we
234
+ could break this out into a new feature. **Handlers**. Here is the `handler`
235
+ for the `left` property:
236
+
237
+ ```ruby
238
+ Teacup.handler UIView, :left { |view, x|
239
+ f = view.frame
240
+ f.origin.x = x
241
+ view.frame = f
242
+ }
243
+ ```
244
+
245
+ How about setting the title of a `UIButton`?
246
+
247
+ ```ruby
248
+ Teacup.handler UIButton, :title { |view, title|
249
+ target.setTitle(title, forState: UIControlStateNormal)
250
+ }
251
+ ```
252
+
253
+ You can also make aliases for long method names, or to shorten a style you use a
254
+ lot. You can alias two ways - give multiple names in a `Teacup.handler` method,
255
+ or use `Teacup.alias`.
256
+
257
+ ```ruby
258
+ # the actual `left` handler offers an alias `x`
259
+ Teacup, handler UIView, :left, :x { |view, x|
260
+ f = view.frame
261
+ f.origin.x = x
262
+ view.frame = f
263
+ }
264
+
265
+ # but I speak japanese, and I want it to be called "hidari" instead, and I want
266
+ # top to be "ue".
267
+ Teacup.alias UIView, :hidari => :left, :ue => :top
268
+ ```
269
+
270
+ extends:
271
+ =======
272
+
273
+ You might have a view where all the buttons or text fields have similar colors
274
+ or font. You can have them extend a common style declaration.
275
+
276
+ ```ruby
277
+ style :button,
278
+ font: UIFont.systemFontOfSize(20)
279
+
280
+ style :ok_button, extends: :button,
281
+ title: "OK"
282
+
283
+ style :cancel_button, extends: :button,
284
+ title: "Cancel"
285
+ ```
286
+
287
+ Precedence is important. We said that "orientation" overrides "generic", but
288
+ that is only at the local `style` declaration level. If you declare a property
289
+ in `style` that is set in an orientation hash in an extended style, *your*
290
+ property will win.
291
+
292
+ ```ruby
293
+ style :button,
294
+ portrait: {
295
+ width: 40
296
+ },
297
+ landscape: {
298
+ width: 45
299
+ }
300
+
301
+ style :ok_button, extends: :button,
302
+ title: "OK",
303
+ width: 40 # width will always be 40, even in landscape
304
+
305
+ style :cancel_button, extends: :button,
306
+ title: "Cancel"
307
+ # width will be 40 or 45, depending on orientation
308
+ ```
309
+
310
+ import
311
+ ======
312
+
313
+ Each `UIView` or `UIViewController` can have only one stylesheet attached to it.
314
+ If you want to break up a stylesheet into multiple sheets, you will use `import`
315
+ to do it.
316
+
317
+ ```ruby
318
+ Teacup::Stylesheet.new :base do
319
+ style :button,
320
+ font: UIFont.systemFontOfSize(20)
321
+ end
322
+
323
+ Teacup::Stylesheet.new :main do
324
+ import :base
325
+
326
+ style :ok_button, extends: :button,
327
+ top: 10
328
+ end
329
+
330
+ Teacup::Stylesheet.new :register do
331
+ import :base
332
+
333
+ style :submit_button, extends: :button,
334
+ top: 50
335
+ end
336
+ ```
337
+
338
+ UIView classes
339
+ ==============
340
+
341
+ You can style entire classes of `UIView`s! These get merged in last (lowest
342
+ precedence), but they are a great way to get site-wide styles. Put these in a
343
+ base stylesheet, and import that stylesheet everywhere. The Apple
344
+ `UIAppearance` protocol/classes do this same thing, but in much more code ;-)
345
+
346
+ ```ruby
347
+ Teacup::Stylesheet.new :base do
348
+ style UIButton,
349
+ font: UIFont.systemFontOfSize(20)
350
+ end
351
+
352
+ Teacup::Stylesheet.new :main do
353
+ style :ok_button, # no need to use extends
354
+ top: 10
355
+ end
356
+
357
+ Teacup::Stylesheet.new :register do
358
+ style :submit_button, # no need to use extends
359
+ top: 50
360
+ end
361
+ ```
362
+
363
+ Precedence, and Style
364
+ ==========
365
+
366
+ 1. Within a `style` declaration, orientation-specific properties override generic properties
367
+ 2. Imported properties will be merged in, but no values from (1) will be overridden
368
+ 3. Extended styles will be merged in, but no values from (1) or (2) will be overridden
369
+ 4. Styles applied to an ancestor will be merged in, but no values from (1) or (2) or (3) will be overridden
370
+
371
+ These rules are maintained in the `Style` class. It starts by creating a Hash
372
+ based on the `style` declaration, then merges the orientation styles, if
373
+ applicable (orientation styles override). Next it merges imports, then
374
+ extends, and finally the class ancestors. At each "merge" except orientation
375
+ merges, it is a recursive-soft-merge, meaning that Hashes will be merged, but
376
+ existing keys will be left alone.
377
+
378
+ Unless you are going to be hacking on teacup, you do not need to understand the
379
+ nitty-gritty - just remember the precedence rules.
380
+
87
381
  Development
88
382
  -----------
89
383
 
90
- *Current version*: v0.0.0 (or see `lib/teacup/version.rb`)
384
+ *Current version*: v0.2.0 (or see `lib/teacup/version.rb`)
385
+
386
+ *Last milestone*: Release layout and stylesheet DSL to the world.
387
+
388
+ *Next milestone*: Provide default styles, that mimic Interface Builder's object library
91
389
 
92
- *Last milestone*: Pick a name
390
+ **Changelog v0.2.0:**
391
+
392
+ - Stylesheets are no longer constants. Instead, they can be fetched by name: `Teacup::Stylesheet[:iphone]`
393
+ - Stylesheets can be assigned by calling the `stylesheet :stylesheet_name` inside a view controller.
394
+ - Ability to style based on view class.
395
+ - Support for orientation-based styles.
93
396
 
94
- *Next milestone*: Pick a DSL
95
397
 
96
398
  teacup, being a community project, moves in "spurts" of decision making and
97
- coding. Only the name both the least and most important part :-) — is
98
- decided.
399
+ coding. We will announce when we are in "proposal mode". That's a good time to
400
+ jump into the project and offer suggestions for its future.
401
+
402
+ And we're usually hanging out over at the `#teacuprb` channel on `irc.freenode.org`.
403
+
404
+ The Dummy
405
+ ---------
99
406
 
100
- We would love suggestions of any sort, and we're always free over at the `#teacuprb` channel on `irc.freenode.org`.
407
+ If you get an error that looks like this:
101
408
 
409
+ Objective-C stub for message `setHidesWhenStopped:' type `v@:c' not
410
+ precompiled. Make sure you properly link with the framework or library that
411
+ defines this message.
102
412
 
103
- Ideas that proposals should keep in mind
104
- ----------------------------------------
413
+ You need to add your method to dummy.rb. This is a compiler issue, nothing we
414
+ can do about it except build up a huge dummy.rb file that has just about every
415
+ method that you would want to style.
105
416
 
106
- 1. output will conform, unless explicitly *disabled* to the [iOS HIG][]
107
- 2. should provide a few useful layouts (see [readme for layout proposals](teacup/tree/master/proposals/layout)):
108
- * basic: vertically arranged "things", or
109
- * form: label/input combinations arranged in a table
110
- * navbar: with ability to customize the buttons that get placed at the top
111
- * tabbar: similar, but with the tabs at the bottom instead of nav at the top
112
- * splitview: A splitview controller (for iPad Apps) with sane navigation defaults, nice loading webviews and JSON to populate the items in the popover menu
417
+ Example
418
+ =======
113
419
 
114
- 3. layouts should have ways of placing things relative to edges, so placing a
115
- label or nav at the "bottom" that spans the entire width should be *easy*.
116
- (This means we'll need to check for ipad or iphone.)
117
- 4. actions are either blocks, defined inline, or target/action combos (e.g.
118
- `target: self, action: :my_method`)
119
- 5. there should be a consistent "styling" language, preferably in a separate
120
- file, something that could be handed to a designer. this is the BIG item!
121
- 6. teacup should take a little `config` block for easy configuration
122
- 7. Ideally, there should be some way to "inherit" styles in this language. So you can define a basic layout for all platforms and then tweak (see [readme for style proposals](teacup/tree/master/proposals/styles))
420
+ The error above was from trying to style the
421
+ `UIActivityIndicatorView#hidesWhenStopped` property. Make a new `Dummy` class,
422
+ subclass the class *where the method is defined* (not a subclass, please) and
423
+ add that method to a `dummy` method. You should assign it `nil` so that the
424
+ method signature looks right. And you should mark it private, too.
123
425
 
124
- [iOS HIG]: http://developer.apple.com/library/ios/#DOCUMENTATION/UserExperience/Conceptual/MobileHIG/Introduction/Introduction.html
426
+ ```ruby
427
+ class DummyActivityIndicatorView < UIActivityIndicatorView
428
+ private
429
+ def dummy
430
+ setHidesWhenStopped(nil)
431
+ end
432
+ end
433
+ ```
125
434
 
126
435
  Bugs
127
436
  ----
128
437
 
129
- Please, do *not* hesitate to report any bugs you find with our source at the [Issues](https://github.com/rubymotion/teacup/issues) page.
130
-
131
- Actual proposals
132
- ----------------
133
-
134
- 1. [stylesheet][Commune], by [ConradIrwin][]
135
- 2. [teacup][teacup_colinta], by [colinta][]
136
- 3. [style][style_by_beakr], by [Beakr][]
137
- 3. [layout][layout_by_beakr], by [Beakr][]
138
- 4. [layout][layout_by_farcaller], by [farcaller][]
139
- 5. [hybrid][], by [colinta][]
140
-
141
- [Commune]: https://github.com/colinta/teacup/blob/master/proposals/styles/stylesheet_by_conradirwin.rb
142
- [teacup_colinta]: https://github.com/colinta/teacup/blob/master/proposals/styles/teacup_by_colinta.rb
143
- [style_by_beakr]: https://github.com/colinta/teacup/blob/master/proposals/layout/beakr_improved.rb
144
- [layout_by_beakr]: https://github.com/colinta/teacup/blob/master/proposals/styles/beakr_improved.rb
145
- [layout_by_farcaller]: https://github.com/colinta/teacup/blob/master/proposals/styles/layout_by_farcaller.rb
146
- [hybrid]: https://github.com/colinta/teacup/blob/master/proposals/layout/hybrid_style_and_layout_by_colinta.rb
147
-
148
- [ConradIrwin]: https://github.com/ConradIrwin
149
- [colinta]: https://github.com/colinta
150
- [farcaller]: https://github.com/farcaller
151
- [Beakr]: https://github.com/Beakr
438
+ Please report any bugs you find with our source at the
439
+ [Issues](https://github.com/rubymotion/teacup/issues) page.
data/Rakefile CHANGED
@@ -1,39 +1,11 @@
1
- #!/usr/bin/env rake
1
+ $:.unshift('/Library/RubyMotion/lib')
2
+ require 'motion/project'
3
+ require 'bundler'
4
+ Bundler.require
2
5
 
3
- # Bundler gem tasks ftw
4
- require 'bundler/gem_tasks'
5
6
 
6
- require 'rspec/core/rake_task'
7
- require File.expand_path '../lib/teacup/version.rb', __FILE__
8
-
9
- # Default task
10
- task :default => :spec # Run spec
11
- task :v => :version # Alt
12
-
13
- # - - - - - - - - - - - - - - - - - - -
14
- # Tasks
15
- # - - - - - - - - - - - - - - - - - - -
16
-
17
- desc 'display Teacup\'s current version'
18
- task(:version) { version }
19
-
20
- desc 'diesplay list of contributors'
21
- task(:contrib) { contrib }
22
-
23
- desc 'run RSpec tests'
24
- RSpec::Core::RakeTask.new
25
-
26
- desc 'build and install the gem'
27
- task(:prep) { system('rake build; rake install') }
28
-
29
- # - - - - - - - - - - - - - - - - - - -
30
- # Helpers
31
- # - - - - - - - - - - - - - - - - - - -
32
-
33
- def version
34
- puts "Teacup #{Teacup::VERSION}"
35
- end
36
-
37
- def contrib
38
- puts Teacup::CONTRIBUTORS
7
+ Motion::Project::App.setup do |app|
8
+ # Use `rake config' to see complete project settings.
9
+ app.name = 'teacup'
10
+ app.identifier = 'com.rubymotion.teacup'
39
11
  end
@@ -0,0 +1,14 @@
1
+ class AppDelegate
2
+
3
+ def application(application, didFinishLaunchingWithOptions:launchOptions)
4
+ application.setStatusBarStyle(UIStatusBarStyleBlackTranslucent)
5
+
6
+ @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
7
+ @window.rootViewController = FirstController.new
8
+ @window.rootViewController.wantsFullScreenLayout = true
9
+ @window.makeKeyAndVisible
10
+
11
+ true
12
+ end
13
+
14
+ end