Skip to content

Instantly share code, notes, and snippets.

@willrax
Created January 9, 2014 22:18
Show Gist options
  • Save willrax/8343126 to your computer and use it in GitHub Desktop.
Save willrax/8343126 to your computer and use it in GitHub Desktop.
URL Scheme Management (RubyMotion)
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@viewController = Foo.alloc.init
@window.rootViewController = @viewController
@window.rootViewController.wantsFullScreenLayout = true
@window.makeKeyAndVisible
true
end
def application(application, openURL:url, sourceApplication:sourceApp, annotation:annotation)
# Here's where you might parse the url and decide which view controller to use
controller = Bar.alloc.init
@viewController.presentModalViewController(controller, animated:true)
true
end
end
class Foo < UIViewController
def viewDidLoad
self.view = UIImageView.alloc.initWithImage(UIImage.imageNamed('foo.png'))
end
end
class Bar < UIViewController
def viewDidLoad
self.view = UIImageView.alloc.initWithImage(UIImage.imageNamed('bar.png'))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment