您好,我不断收到错误“在范围内找不到'getKeyboardHeight'”和“在范围内找不到'UIKeyboardWillShow'”

时间:2020-10-15 16:25:50

标签: swift model-view-controller scope keyboard

我是敏捷和MVC架构模式的初学者。我一直在收到此错误,“在范围内找不到'getKeyboardHeight'”,每当我尝试实现某些东西时,都会出现“无法在范围内找到... getKeyboardHeight”错误,而我只是无法弄清楚如何解决它。我将从视图控制器以及模型中粘贴代码,因为我怀疑这是从该代码中获取的。谢谢您的帮助!

@objc func keyboardWillShow(_ notification:Notification) {
    view.frame.origin.y = -getKeyboardHeight(notification)
}

func subscribeToKeyboardNotification() {
    Notification.default.addObserver(self, selector: #selector(keyboardWillShow(_:)),
    name: UIKeyboardWillShow, object: nil)
    
}

这是我的模特

import UIKit

Class MemeModel: NSObject {
   var image: UIImage?
   var topText: String?
   var bottomText: String?


init(topText: String?, bottomText: String?, image: UIImage?) {
    super.init()
    self.topText = topText
    self.bottomText = bottomText
    self.image = image
    
}
}

0 个答案:

没有答案