Skip to content

Instantly share code, notes, and snippets.

@jamonholmgren
Forked from twerth/gist:848c9484ad63781ed60d
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamonholmgren/e8f7a304c1a346d3e4c2 to your computer and use it in GitHub Desktop.
Save jamonholmgren/e8f7a304c1a346d3e4c2 to your computer and use it in GitHub Desktop.
class MainScreen
stylesheet MainControllerStylesheet
def on_load
set_state({ first_name: "Jamon", last_name: "Holmgren" })
attach_events
end
def attach_events
find(:button).on(:tap) { set_state({ first_name: "Todd", last_name: "Werth" }) }
end
end
class MainControllerStylesheet < ApplicationStylesheet
def setup
# Add stylesheet specific setup stuff here.
# Add application specific setup stuff in application_stylesheet.rb
end
def layout
find_or_append(UILabel, :first_name_label)
find_or_append(UILabel, :first_name).data(state[:first_name])
find_or_append(UILabel, :last_name_label)
find_or_append(UILabel, :last_name).data(state[:first_name])
end
# ... styles here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment