Swift 2.3 迁移 Swift 3.0 遇到困难和部分解决方案

Swift 2.3 迁移 Swift 3.0 遇到困难和部分解决方案,第1张

概述警告:Expression of type ‘UIViewController?’ is unused // 赋值给_,否则会报Expression of type 'UIViewController?' is unused_ = self.navigationController?.popViewController(animated: true) isKindOfClass没有了 // 2.

警告:Expression of type ‘UIVIEwController?’ is unused

// 赋值给_,否则会报Expression of type 'UIVIEwController?' is unused_ = self.navigationController?.popVIEwController(animated: true)

isKindOfClass没有了

// 2.3vIEwController.isKindOfClass(PhoneRegVIEwController)// 3.0vIEwController.isKind(of: PhoneRegVIEwController.self)

通知也变了

// 2.3NSNotificationCenter.defaultCenter().postNotificationname("userinfoChanged",object: notification)// 3.0NotificationCenter.default.post(name: NSNotification.name(rawValue: "userinfoChanged"),object: notification)// 2.3NSNotificationCenter.defaultCenter().addobserver(self,selector: #selector(currentPageChanged(_:)),name: "loginPageChanged",object: nil)// 3.0NotificationCenter.default.addobserver(self,selector: #selector(currentPageChanged),name: NSNotification.name(rawValue: "loginPageChanged"),object: nil)

zhege

// 2.3overrIDe func touchesEnded(touches: Set<UItouch>,withEvent event: UIEvent?) { txtReply.resignFirstResponder() }// 3.0overrIDe func touchesEnded(_ touches: Set<UItouch>,with event: UIEvent?) { txtReply.resignFirstResponder() }
// 2.3btnOk.addTarget(self,action: #selector(okClick(_:)),forControlEvents: .touchUpInsIDe)// 3.0btnOk.addTarget(self,action: #selector(okClick),for: .touchUpInsIDe)
// 2.3var time = dispatch_time(disPATCH_TIME_Now,Int64(duration * Double(NSEC_PER_SEC)))    dispatch_after(time,dispatch_get_main_queue()) {        self.stopAnimating()}// 3.0dispatchQueue.main.asyncAfter(deadline: .Now() +duration) {    self.stopAnimating()}
// 2.3self.arrow.frame = CGRectOffset(arrow.frame,0,0)// 3.0self.arrow.frame = arrow.frame.offsetBy(dx: 0,dy: 0)
总结

以上是内存溢出为你收集整理的Swift 2.3 迁移 Swift 3.0 遇到困难和部分解决方案全部内容,希望文章能够帮你解决Swift 2.3 迁移 Swift 3.0 遇到困难和部分解决方案所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1067740.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存