rubymotion/teacup — pull request #29 by colinta (2012-06-11 21:48:02+00:00)
Title: Welcome.  Welcome to teacup (v0.2.0)

Before merging! You must pull this branch, run `rake spec` to run the spec/ tests.

cirwin: I'm including stylesheet_specs.rb and view_specs.rb, modified of course.

this issue relates to this pull request: #27 - it is resolved, but you can't use local variables in the block anymore (why not? it should be a proper closure... strange)

Changes - copying these from #25

## major changes & features

1. Instead of `Teacup::Stylesheet::Ipad`, the stylesheets are available using `Teacup::Stylesheet[:stylesheet_name]`.
2. The stylesheet setter accepts a `:name`, and later looks it up. This removes the dependency that `Stylesheet`s be loaded before controllers. This code is in the `Teacup::View#stylesheet` getter.
3. Adds per-orientation-based styling! If the root view includes styles for `landscape` and other orientation names, those orientations will be allowed in the `autorotateToOrientation(orientation)` method. You have to call this method from your *own* `shouldAutorotateToInterfaceOrientation(orientation)` method.
4. No more `Teacup::View` - just `UIView` and `UIViewController` extensions, and the `Teacup::Layout` module, which both of those classes extend.
5. Specs now use the rubymotion `rake spec` instead of the built-in ruby one. I had to change the specs a lot to get this to work, but it's nice to be testing a running app, instead of using mock objects.

## minor changes

1. Adds a `stylesheet` method to UIViewController. You can set a "default" stylesheet name or instance.

```ruby
class MyViewController < UIViewController
stylesheet :my_view
layout do
# ...
end
end
```
2. Stylename is optional in the `Teacup::Layout#layout` method, so you can add subviews and styles without declaring a style name.