Module: Teacup::ControllerClass
- Defined in:
- lib/teacup/teacup_controller.rb
Instance Attribute Summary collapse
-
#layout_definition ⇒ Object
readonly
Returns the value of attribute layout_definition.
Instance Method Summary collapse
-
#layout(stylename = nil, properties = {}) ⇒ Object
Define the layout of a controller’s view.
Instance Attribute Details
#layout_definition ⇒ Object (readonly)
Returns the value of attribute layout_definition.
7 8 9 |
# File 'lib/teacup/teacup_controller.rb', line 7 def layout_definition @layout_definition end |
Instance Method Details
#layout(stylename = nil, properties = {}) ⇒ Object
Define the layout of a controller’s view.
This function is analogous to Teacup::Layout#layout, though it is designed so you can create an entire layout in a declarative manner in your controller.
The hope is that this declarativeness will allow us to automatically deal with common iOS programming tasks (like releasing views when low-memory conditions occur) for you. This is still not implemented though.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/teacup/teacup_controller.rb', line 43 def layout(stylename=nil, properties={}) if block_given? msg = <<-MSG Time to update your syntax! It was discovered that passing a block to the Controller##layout was causing irreparable memory leaks. The only recourse is to use a new syntax and remove the old functionality. If you need to assign a stylename to the root view, you can still do this using `layout :stylename`, but you cannot pass a block to this class method any longer. Instead, define a method called `teacup_layout` and create your views there. No other changes are required. MSG raise msg end @layout_definition = [stylename, properties] end |