1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- //
- // Test3ViewController.swift
- // MCPlus
- //
- // Created by seo ha on 30/01/2019.
- // Copyright © 2019 KangSH. All rights reserved.
- //
- import UIKit
- import Photos
- import ReactiveCocoa
- import ReactiveSwift
- class PictureViewController: UIViewController {
- @objc var callBack:(([String:String])->Void)?
-
- var user:User?
-
- @IBOutlet weak var cameraContainer: UIView!
-
- @IBOutlet weak var gallaryContainer: UIView!
-
-
- static var patientId = MutableProperty<String?>(nil)
- static var patientNm = MutableProperty<String?>(nil)
- static var ageGender = MutableProperty<String?>(nil)
- }
- extension PictureViewController{
- override func viewDidLoad() {
- super.viewDidLoad()
-
- PictureViewController.patientId.value = user?.patientId
- PictureViewController.patientNm.value = user?.patientNm
- PictureViewController.ageGender.value = "\(user?.age ?? "") / \(user?.gender ?? "")"
- }
-
- func scanAction(){
- let alert = UIAlertController(title: "선택하세요", message: "", preferredStyle: .actionSheet)
- alert.addAction(UIAlertAction(title: "카메라", style: .default, handler: self.cameraAction))
- alert.addAction(UIAlertAction(title: "갤러리", style: .default, handler: self.gallaryAction))
-
- // show action sheet
- if let popoverController = alert.popoverPresentationController {
- popoverController.sourceView = self.view
- popoverController.sourceRect = CGRect(x: self.view.bounds.midX, y: self.view.bounds.midY, width: 0, height: 0)
- popoverController.permittedArrowDirections = []
- }
-
- self.present(alert, animated: true, completion: nil)
- }
-
- //커스텀 카메라 호출
- func cameraAction(action:UIAlertAction?){
- self.cameraContainer.isHidden = false
- self.gallaryContainer.isHidden = true
- }
-
- //포토 갤러리 호출
- func gallaryAction(action:UIAlertAction?){
- self.cameraContainer.isHidden = true
- self.gallaryContainer.isHidden = false
- }
-
-
- }
|