//
//  PhotoDetailViewController.swift
//  MCPlus
//
//  Created by seo ha on 07/02/2019.
//  Copyright © 2019 KangSH. All rights reserved.
//

import UIKit

class PhotoDetailViewController: UIViewController {
    
    @IBOutlet weak var closeButton: UIImageView!{
        didSet{
            closeButton.addTapGestureRecognizer(action: self.closeAction)
        }
    }
    
    @IBOutlet weak var scrollView: UIScrollView!{
        didSet{
            scrollView.delegate = self
        }
    }
    
    @IBOutlet weak var imageView: UIImageView!
    
    var image:UIImage?
}

extension PhotoDetailViewController:UIScrollViewDelegate{
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        if let img = self.image{
            self.imageView.image = img
        }
    }
    
    func closeAction(){
        self.navigationController?.popViewController(animated: true)
    }
    
    func viewForZooming(in scrollView: UIScrollView) -> UIView? {
        return scrollView.subviews.first
    }
}
