README.md in ProMotion-0.1.0 vs README.md in ProMotion-0.1.1
- old
+ new
@@ -39,11 +39,11 @@
def on_load
# Set up the elements in your view with add_element:
@label = add_element UILabel.alloc.initWithFrame(CGRectMake(5, 5, 20, 20)), {
text: "This is awesome!",
- font: UIFont.UIFont.systemFontOfSize(18)
+ font: UIFont.systemFontOfSize(18)
}
end
def on_appear
# Refresh the data if you want
@@ -91,10 +91,16 @@
@settings_screen = SettingsScreen.new
open_screen @settings_screen
end
```
+Open a new screen as a modal:
+
+```ruby
+open_screen SettingsScreen, modal: true
+```
+
You can pass in arguments to other screens if they have accessors:
```ruby
class HomeScreen < ProMotion::Screen
# ...
@@ -145,10 +151,22 @@
# Note: on_appear will not fire when using a custom
# view controller.
end
```
-The helper add_element takes a
+The helper add_element takes any view object and adds it to the current view. You can also use
+the helper ProMotion::ViewHelper.set_attributes(view, attributes) to do the same thing without adding
+it to the current view. Screens include this helper by default.
+
+```ruby
+@element = add_element UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), {
+ backgroundColor: UIColor.whiteColor
+}
+
+@element = set_attributes(UIView.alloc.initWithFrame(CGRectMake(0, 0, 20, 20)), {
+ backgroundColor: UIColor.whiteColor
+}
+```
You can create sectioned table screens easily. TableScreen, SectionedTableScreen, GroupedTableScreen
```ruby
class SettingsScreen < ProMotion::GroupedTableScreen