Last active
August 29, 2015 14:08
-
-
Save angelsystem/bb306b4291832bec8733 to your computer and use it in GitHub Desktop.
use image galley or camera swift
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
// | |
// ViewController.swift | |
// | |
// Created by Angelito Rojas on 25/10/14. | |
// Copyright (c) 2014 Angelito Rojas. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate { | |
@IBOutlet weak var pickedImage: UIImageView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
@IBAction func pickImage(sender: AnyObject) { | |
var image = UIImagePickerController() | |
image.delegate = self | |
image.sourceType = UIImagePickerControllerSourceType.Camera | |
//image.sourceType = UIImagePickerControllerSourceType.PhotoLibrary | |
// image.allowsEditing = false | |
image.allowsEditing = true | |
self.presentViewController(image, animated: true, completion: nil) | |
} | |
func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) { | |
self.dismissViewControllerAnimated(true, completion: nil) | |
pickedImage.image = image | |
} | |
override func didReceiveMemoryWarning() { | |
super.didReceiveMemoryWarning() | |
// Dispose of any resources that can be recreated. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment