Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.18 KB | None | 0 0
  1. //
  2. // LoginViewController.swift
  3. // Digipro
  4. //
  5. // Created by desarrollo digipro on 04/12/17.
  6. // Copyright © 2017 digipro. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import Foundation
  11. import SWXMLHash
  12. import SwiftyJSON
  13.  
  14. class LoginViewController: BaseViewController, UITextFieldDelegate, NSURLConnectionDataDelegate,NSURLConnectionDelegate,XMLParserDelegate {
  15.  
  16.  
  17. @IBOutlet weak var uiLabelTitle: UILabel!
  18. @IBOutlet weak var uiLabelSubtitle: UILabel!
  19. @IBOutlet weak var uiLabelUsername: UILabel!
  20. @IBOutlet weak var uiLabelPassword: UILabel!
  21. @IBOutlet weak var uiTextFieldUsername: UITextField!
  22. @IBOutlet weak var uiTextFieldPassword: UITextField!
  23. @IBOutlet weak var errorLabel1: UILabel!
  24. @IBOutlet weak var errorLabel2: UILabel!
  25. @IBOutlet weak var errorImage1: UIImageView!
  26. @IBOutlet weak var errorImage2: UIImageView!
  27.  
  28.  
  29. override func viewDidLoad() {
  30. super.viewDidLoad()
  31. setupUI()
  32.  
  33. }
  34. override func viewWillAppear(_ animated: Bool){
  35. super.viewDidAppear(animated)
  36. navigationController?.setNavigationBarHidden(true, animated: false)
  37. }
  38.  
  39. override func viewWillDisappear(_ animated: Bool) {
  40. super.viewWillDisappear(animated)
  41. navigationController?.setNavigationBarHidden(false, animated: true)
  42. }
  43.  
  44. func setupUI(){
  45. uiTextFieldUsername.autocorrectionType = .no
  46. uiTextFieldPassword.autocorrectionType = .no
  47. print(getValuesFromSkin)
  48. uiTextFieldUsername.delegate = self
  49. uiTextFieldPassword.delegate = self
  50. self.errorImage1.isHidden = true
  51. self.errorImage2.isHidden = true
  52. self.errorLabel1.isHidden = true
  53. self.errorLabel2.isHidden = true
  54.  
  55. }
  56. func textFieldShouldReturn(_ textField: UITextField) -> Bool {
  57. textField.resignFirstResponder()
  58. return true
  59. }
  60.  
  61.  
  62.  
  63. @IBAction func conect(_ sender: Any) {
  64.  
  65. getValuesFromSkin(paramCode: "")
  66.  
  67. }
  68.  
  69.  
  70.  
  71.  
  72. func getValuesFromSkin(paramCode: String){
  73. let object = FESkin(AplicacionID: 1, ProyectoID: 2, Splash: "")
  74. let obj = UsuarioRepositorio()
  75. let skin = ObtieneSkin()
  76. let utils = ExtensionUtils()
  77. skin.cpSkin = utils.encodeToJson(object)
  78. obj.opObtieneSkin(obtieneSkin: skin) { (response: ObtieneSkinResponse?, error:NSError?) -> Void in
  79. // print("respuesta del servicio \(response?.loginResponseString as Any)")
  80.  
  81. DispatchQueue.main.async{
  82.  
  83. let servise: String = response?.loginResponseString ?? ""
  84. let json = try! JSON(data: servise.data(using: .utf8)!)
  85. // let n = json["Titulo"]
  86.  
  87.  
  88. // for (index, item) in json.enumerated() {
  89. // print("item numero \(index+1) : \(item)")
  90. // }
  91. print(json)
  92. }
  93.  
  94. }
  95. }
  96. override func didReceiveMemoryWarning() {
  97. super.didReceiveMemoryWarning()
  98.  
  99. }
  100.  
  101.  
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement