zoukankan      html  css  js  c++  java
  • swift 第五课 定义model类 和 导航栏隐藏返回标题

    1. 网络请求返回数据时候,把数据转化为model,但是有时候会返回空的字符串,所以加载了个长度的判断:

    class Model : NSObject{
    
        var details_url:String?
        var easy_time:String?
      }
     
        class func creatModel(dictionary :Dictionary<String, Any>) -> Model{
     
            let model = Model.init()
            model.setValuesForKeys(dictionary)
            
            return model
        }

        override func setValue(_ value: Any?, forUndefinedKey key: String) {
        }
          if (self.model?.details_url) != nil && (self.model?.details_url?.characters.count)! > 0
                {
                self.urlString = self.model?.details_url;
            }
            else if ( self.model?.easy_url ) != nil  && (self.model?.easy_url?.characters.count)! > 0
            {
                self.urlString = self.model?.easy_url;
            }
            else{
                NSLog("无效的 web url");
            }

    2.隐藏导航栏 返回的标题:

    self.navigationItem.backBarButtonItem = UIBarButtonItem.init(title: "", style:.plain, target: nil, action: nil)
    
  • 相关阅读:
    grunt 记录
    angularjs 剪贴板
    translate
    鼠标事件
    Typora书写macdown语法教程
    idea常用插件安装
    JDBC使用8.0驱动包连接mysql设置时区serverTimezone
    多服务器部署脚本
    jar包重启脚本-restart.sh
    spring-boot分环境打包为tar包
  • 原文地址:https://www.cnblogs.com/Bob-blogs/p/6565902.html
Copyright © 2011-2022 走看看