Skip to content

Instantly share code, notes, and snippets.

@jamonholmgren
Created May 16, 2013 00:23
Show Gist options
  • Save jamonholmgren/5588519 to your computer and use it in GitHub Desktop.
Save jamonholmgren/5588519 to your computer and use it in GitHub Desktop.
Teacup::Stylesheet.new :main do
style :my_style,
constraints: [
constrain_left(0),
constrain_width(100),
constrain_top(0),
constrain(:bottom).equals(:superview, :bottom),
]
end
class HomeScreen < PM::Screen
stylesheet :main
def will_appear
add UIView, :my_style
end
end
@colinta
Copy link

colinta commented May 16, 2013

is PM::Screen a subclass of UIViewController?

@jamonholmgren
Copy link
Author

Yes, sure is.

@puelocesar
Copy link

That doesn't work here, any ideas?

I get:

2013-10-08 17:07:41.156 LumieVideo[41938:a0b] +[UIView superview]: unrecognized selector sent to class 0x17207e0
(main)> 2013-10-08 17:07:42.872 LumieVideo[41938:a0b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIView superview]: unrecognized selector sent to class 0x17207e0'
*** First throw call stack:

@puelocesar
Copy link

Nevermind, I just had to call this way:
add UIView, { stylename: :background }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment