Sha256: 4e78dda8bc539d5464399a8c2297922e4536f21b5421433697566466eb7c3c52
Contents?: true
Size: 1.82 KB
Versions: 2
Compression:
Stored size: 1.82 KB
Contents
class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @controller = UIViewController.alloc.initWithNibName(nil, bundle:nil) @window.rootViewController = @controller @window.makeKeyAndVisible Twitter.sign_in do |granted, error| if granted compose = UIButton.buttonWithType(UIButtonTypeRoundedRect) compose.setTitle("Compose", forState:UIControlStateNormal) compose.sizeToFit @controller.view.addSubview(compose) compose.when UIControlEventTouchUpInside do account = Twitter.accounts[0] account.compose(tweet: "Hello World!", urls: ["http://clayallsopp.com"]) do |composer| p "Done? #{composer.done?}" p "Cancelled? #{composer.cancelled?}" p "Error #{composer.error.inspect}" end end timeline = UIButton.buttonWithType(UIButtonTypeRoundedRect) timeline.setTitle("Timeline", forState:UIControlStateNormal) timeline.setTitle("Loading", forState:UIControlStateDisabled) timeline.sizeToFit timeline.frame = compose.frame.below(10) @controller.view.addSubview(timeline) timeline.when UIControlEventTouchUpInside do timeline.enabled = false account = Twitter.accounts[0] account.get_timeline do |hash, error| timeline.enabled = true p "Timeline #{hash}" end end else label = UILabel.alloc.initWithFrame(CGRectZero) label.text = "Denied :(" label.sizeToFit label.center = @controller.view.frame.center @controller.view.addSubview(label) end end true end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twittermotion-0.0.2 | app/app_delegate.rb |
twittermotion-0.0.1 | app/app_delegate.rb |