lib/teacup/layout.rb in teacup-0.3.7 vs lib/teacup/layout.rb in teacup-0.3.8

- old
+ new

@@ -1,6 +1,5 @@ - module Teacup # Teacup::Layout defines a layout and subview function that can be used to # declare and configure the layout of views and the view hierarchy in your # application. # @@ -54,13 +53,13 @@ # # You can also use this method with {subview}, for example to add a new # image to a carousel: # # @example - # layout(carousel) { + # layout(carousel) do # subview(UIImage, backgroundColor: UIColor.colorWithImagePattern(image) - # } + # end # def layout(view, name_or_properties=nil, properties_or_nil=nil, &block) name = nil properties = properties_or_nil @@ -108,21 +107,21 @@ # # For example, to specify that a controller should contain some labels: # # @example # MyViewController < UIViewController - # heirarchy(:my_view) do + # layout(:my_view) do # subview(UILabel, text: 'Test') # subview(UILabel, :styled_label) # end # end # # If you need to add a new image at runtime, you can also do that: # # @example - # layout(carousel) { + # layout(carousel) do # subview(UIImage, backgroundColor: UIColor.colorWithImagePattern(image) - # } + # end # def subview(class_or_instance, *args, &block) if Class === class_or_instance unless class_or_instance <= UIView raise "Expected subclass of UIView, got: #{class_or_instance.inspect}"