CopyPastor

Detecting plagiarism made easy.

Score: 0.8230147957801819; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-10-03
by uzair iqbal

Original Post

Original - Posted on 2016-11-29
by Lineesh K Mohan



            
Present in both answers; Present only in the new answer; Present only in the old answer;

First, we have to do the setup for Permissions inside Project's .plist file
for swift4
import UIKit class photoPickerController: UIViewController,UINavigationControllerDelegate{ @IBOutlet weak var imageTake: UIImageView! var imagePicker: UIImagePickerController! override func viewDidLoad() { super.viewDidLoad() } @IBAction func takePhoto(_ sender: UIButton) { imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .camera present(imagePicker, animated: true, completion: nil) } @IBAction func saveToLibrary(_ sender: AnyObject) { UIImageWriteToSavedPhotosAlbum(imageTake.image!, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil) } } extension photoPickerController : UIImagePickerControllerDelegate { func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { if let error = error { // we got back an error! let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default)) present(alert, animated: true) } else { let alert = UIAlertController(title: "Saved!", message: "Image saved successfully", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default)) present(alert, animated: true) } } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { imagePicker.dismiss(animated: true, completion: nil) imageTake.image = info[UIImagePickerControllerOriginalImage] as? UIImage } }

import UIKit
class photoPickerController: UIViewController,UINavigationControllerDelegate{ @IBOutlet weak var imageTake: UIImageView! var imagePicker: UIImagePickerController! override func viewDidLoad() { super.viewDidLoad() }
@IBAction func takePhoto(_ sender: UIButton) { imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .camera present(imagePicker, animated: true, completion: nil) }
@IBAction func saveToLibrary(_ sender: AnyObject) { UIImageWriteToSavedPhotosAlbum(imageTake.image!, self, #selector(image(_:didFinishSavingWithError:contextInfo:)), nil) } }
extension photoPickerController : UIImagePickerControllerDelegate {
func image(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) { if let error = error { // we got back an error! let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default)) present(alert, animated: true) } else { let alert = UIAlertController(title: "Saved!", message: "Image saved successfully", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default)) present(alert, animated: true) } } func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { imagePicker.dismiss(animated: true, completion: nil) imageTake.image = info[UIImagePickerControllerOriginalImage] as? UIImage } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;