ios - API 成功 200 后无法在 UIView 内的 UITextField 中显示

标签 ios swift

你能帮我解决这个问题

 WS.pay_bay_cb("some params") {
                          (response) in
          let  abc = response["response"] as? NSDictionary
           print(abc!["ref_code"] as? String) // i get this 12345 code that i want to display
           code_container.hidden = fasle  
           self.validation_code.text = abc!["ref_code"] as? String
     }

我想在 UIView 内的 UITextField 中显示 ref_code。
View 仍然隐藏的问题,任何人都可以向我解释如何解决这个问题,谢谢。

最佳答案

尝试这样

WS.pay_bay_cb("some params") {
                      (response) in
      let  abc = response["response"] as? NSDictionary
       print(abc!["ref_code"] as? String) // i get this 12345 code that i want to display
dispatch_async(dispatch_get_main_queue(), {
       self.code_container.hidden = fasle  
       self.validation_code.text = abc!["ref_code"] as? String
})
 }

关于ios - API 成功 200 后无法在 UIView 内的 UITextField 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41504357/

相关文章:

iOS - 为 iPhone 4S 加载不同的 Storyboard不起作用

ios - 为什么 Storyboard和模拟器之间的布局不同?

ios - UIFlowLayoutSection.updateEstimatedSizeForSection 中的 EXC_ARITHMETIC

iOS Swift - 使用蓝牙外置扬声器时音质不佳

ios - Apple App store 上潜在的 App 拒绝可能性

ios - 从现有 NSArray 创建新 NSArray 的标准约定是什么?

ios - 为什么我不能在 UIButton 子类的便捷初始化程序中使用 "self.init(type: .custom)"

ios - 如何转到导致 xcode 错误的行

ios - 如何使用正则表达式测试阿拉伯语的阿联酋号码?

ios - 快速为常规按钮提供条形按钮标识符