Created
October 26, 2012 22:12
-
-
Save h6y3/3961878 to your computer and use it in GitHub Desktop.
teacup handlers being called 8 times for a single layout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate | |
def application(application, didFinishLaunchingWithOptions:launchOptions) | |
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) | |
@window.rootViewController = MyController.alloc.init | |
@window.rootViewController.wantsFullScreenLayout = true | |
@window.makeKeyAndVisible | |
true | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyController < UIViewController | |
stylesheet :my_controller | |
layout :root do | |
subview(UITextField, :field) | |
end | |
def shouldAutorotateToInterfaceOrientation(orientation) | |
autorotateToOrientation(orientation) | |
end | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world | |
Calling setup with arguments UITextField(#958d620, [[10.0, 10.0], [200.0, 50.0]]), child of UIView(#9581aa0) and Hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Teacup::Stylesheet.new(:my_controller) do | |
Teacup.handler UITextField, :setup { |view, x| | |
puts "Calling setup with arguments #{view} and #{x}" | |
} | |
style :root, | |
landscape: true | |
style :field, | |
left: 10, | |
top: 10, | |
width: 200, | |
height: 50, | |
landscape: { | |
width: 360 # make it wide in landscape view | |
}, | |
setup: "Hello world" | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment