Skip to content

Instantly share code, notes, and snippets.

@gfodor
Created January 23, 2013 03:08
Show Gist options
  • Save gfodor/4601521 to your computer and use it in GitHub Desktop.
Save gfodor/4601521 to your computer and use it in GitHub Desktop.
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@view = UIButton.alloc.initWithFrame([[0,0],[150,150]])
@view.backgroundColor = UIColor.redColor
window.addSubview(@view)
@count = 0
window.makeKeyAndVisible
@view.addTarget(self, action:"tapped", forControlEvents:UIControlEventTouchUpInside)
temp_fields[:foo] = "foo"
true
end
def temp_fields
@fields ||= {}
end
def tapped
foo = temp_fields[:foo]
temp_fields[:foo] = nil # comment out this line to stop crash
puts foo
temp_fields[:foo] = "foo"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment