Skip to content

Instantly share code, notes, and snippets.

@h6y3
Created October 26, 2012 22:12
Show Gist options
  • Save h6y3/3961878 to your computer and use it in GitHub Desktop.
Save h6y3/3961878 to your computer and use it in GitHub Desktop.
teacup handlers being called 8 times for a single layout
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
class MyController < UIViewController
stylesheet :my_controller
layout :root do
subview(UITextField, :field)
end
def shouldAutorotateToInterfaceOrientation(orientation)
autorotateToOrientation(orientation)
end
end
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
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