My code works and lets me pick a image from some kind of default saved camera roll that apple has built in on the computer. If I understand it right - whenever a person would use my app they would of course have it connect to their personal phone.
My question is: I'm trying to test my app using photos from my computer instead of the default photos that apple provides (landscapes and pictures of waterfalls). Is there a way I can directly access a folder on my desktop when I click my browse files button (btnClicked
) and pull a picture out of there?
Here is what I'm using right now. How can I manipulate this to do what I need?
// Custom Image
var imagePicker = UIImagePickerController();
@IBOutlet weak var imageView: UIImageView!
// Button Clicked for Image
@IBAction func btnClicked(sender: AnyObject)
{
if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum){
print("Button capture")
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum;
imagePicker.allowsEditing = false
self.presentViewController(imagePicker, animated: true, completion: nil)
}
}
// View Did Load
override func viewDidLoad()
{
super.viewDidLoad();
// Do any additional setup after loading the view.
// Set the User's "Hairstyle"
userHairStyleLab.text = HairStyle;
}
// Did Receive Memory Warning
override func didReceiveMemoryWarning()
{
super.didReceiveMemoryWarning();
// Dispose of any resources that can be recreated.
}
func imagePickerController(picker: UIImagePickerController!, didFinishPickingImage image: UIImage!, editingInfo: [NSObject: AnyObject]!){
self.dismissViewControllerAnimated(true, completion: { () -> Void in
})
imageView.image = image
}