123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // 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)
- static var deptNm = MutableProperty<String?>(nil)
- static var treatClsKr = MutableProperty<String?>(nil)
- static var doctorNm = MutableProperty<String?>(nil)
-
- }
- extension PictureViewController{
- override func viewDidLoad() {
- super.viewDidLoad()
-
- self.navigationController?.isNavigationBarHidden = true
- // if let testData = "{\"hospitalCD\":\"1000001\",\"patientId\":\"김길동\",\"userId\":\"20\",\"patientNm\":\"M\",\"age\":\"M\",\"gender\":\"M\",\"deptCd\":\"M\",\"deptNm\":\"M\",\"doctorId\":\"M\",\"doctorNm\":\"M\",\"treatCls\":\"M\"}".data(using: .utf8){
- // user = try? JSONDecoder().decode(User.self, from: testData)
- // print(user)
- // }
-
- PictureViewController.patientId.value = user?.patientId
- PictureViewController.patientNm.value = user?.patientNm
- PictureViewController.ageGender.value = "\(user?.age ?? "") / \(user?.gender ?? "")"
- PictureViewController.deptNm.value = user?.deptNm
- PictureViewController.treatClsKr.value = user?.treatClsKr
- PictureViewController.doctorNm.value = user?.doctorNm
- }
-
- 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
- }
-
-
- }
|