Created
January 19, 2013 22:28
-
-
Save gfodor/4575605 to your computer and use it in GitHub Desktop.
This file contains 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) | |
@nav = UINavigationController.alloc.init | |
@window.rootViewController = @nav | |
@window.makeKeyAndVisible | |
image_picker = UIImagePickerController.alloc.init | |
image_picker.sourceType = UIImagePickerControllerSourceTypeCamera | |
image_picker.mediaTypes = [KUTTypeImage] | |
image_picker.allowsEditing = false | |
image_picker.delegate = self | |
@nav.presentViewController(image_picker, animated:true, completion: → {}) | |
true | |
end | |
def imagePickerController(picker, didFinishPickingMediaWithInfo:info) | |
# Closure captures and retains info | |
@nav.dismissViewControllerAnimated(true, completion:lambda do end) | |
# uncomment line below (and comment line above) to remove leak | |
# @nav.dismissViewControllerAnimated(true, completion:nil) | |
end | |
def imagePickerControllerDidCancel(picker) | |
@nav.dismissViewControllerAnimated(true, completion:nil) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment