美文网首页
iOS 11 Xcode9 适配

iOS 11 Xcode9 适配

作者: Zhui_Do | 来源:发表于2017-11-29 15:44 被阅读23次

1.tableview下移 automaticallyAdjustsScrollViewInsets弃用

        if #available(iOS 11.0, *) {
            tableView.contentInsetAdjustmentBehavior = .never
        } else {
            automaticallyAdjustsScrollViewInsets = false;
        };

2.导航栏图片按钮形变: customView不能直接设置button需要加在UIView上,customView设置为view

        let moreBtn = UIButton()
        moreBtn.frame = CGRect(x:0,y:0,width:60,height: 30)
        moreBtn.setBackgroundImage(UIImage(named:"top_menu_more.png"), for: .normal)
        moreBtn.addTarget(self, action:  #selector(MoreClick), for: .touchUpInside)
        
        let moreView = UIView()
        moreView.frame = CGRect(x:0,y:0,width:60,height: 30)
        moreView.addSubview(moreBtn)
        let right = UIBarButtonItem.init(customView: moreView)
      
        self.navigationItem.rightBarButtonItem = right

3.IQKeyboardManager 不显示完成按钮
更新至5.0.6版本

相关文章

网友评论

      本文标题:iOS 11 Xcode9 适配

      本文链接:https://www.haomeiwen.com/subject/xtsdbxtx.html