this is the minimum.
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate ,UINavigationControllerDelegate{
@IBAction func openPhotoLibrary(sender: UIButton) {
var photoPicker = UIImagePickerController()
photoPicker.delegate = self
photoPicker.sourceType = .PhotoLibrary
self.presentViewController( photoPicker, animated: true, completion: nil)
}
@https://www.youtube.com/watch?v=leyk3QOYJF0
complete ver of this instruction video
import UIKit
var photoImageView = UIImageView(frame: CGRectMake(40, 120, 200, 200))
@IBAction func openPhotoLibrary(sender: UIButton) {
var photoPicker = UIImagePickerController()
photoPicker.delegate = self
photoPicker.sourceType = .PhotoLibrary
self.presentViewController( photoPicker, animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
override func didReceiveMemoryWarning() {
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject: AnyObject]) {
}
complete ver of this instruction video
import UIKit
class ViewController: UIViewController, UIImagePickerControllerDelegate ,UINavigationControllerDelegate{
var photoPicker = UIImagePickerController()
photoPicker.delegate = self
photoPicker.sourceType = .PhotoLibrary
super.viewDidLoad()
self.view.addSubview(photoImageView)
// Do any additional setup after loading the view, typically from a nib.
}
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
photoImageView.image = info [UIImagePickerControllerOriginalImage]as? UIImage
self.dismissViewControllerAnimated(false, completion: nil)
}
No comments:
Post a Comment