IQKeyboardManager Swift Does Not Work At All

huangapple go评论70阅读模式
英文:

IQKeyboardManager Swift Does Not Work At All

问题

根据您的要求,以下是代码部分的翻译:

Debug Code:

IQKeyboardManager|	⌨️>>>>> keyboardWillHide(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager|	⌨️<<<<< keyboardWillHide(_:) ended: 0.00040386100590694696 seconds <<<<<
IQKeyboardManager|	⌨️>>>>> keyboardDidHide(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager|	⌨️<<<<< keyboardDidHide(_:) ended: 8.349800191354007e-05 seconds <<<<<
IQKeyboardManager|	UIKeyboard Frame: (0.0, 808.0, 393.0, 119.0)
IQKeyboardManager|	⌨️>>>>> keyboardWillShow(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager|	|	Saving <YACHT_NOW.ChatRoomView: 0x7f9518847e00> beginning origin: (0.0, 0.0)
IQKeyboardManager|	⌨️<<<<< keyboardWillShow(_:) ended: 0.0001746119960444048 seconds <<<<<
IQKeyboardManager|	>>>>> adjustPosition() started >>>>>
IQKeyboardManager|	|	Need to move: 26.0
IQKeyboardManager|	|	Moving Upward
IQKeyboardManager|	|	Set <YACHT_NOW.ChatRoomView: 0x7f9518847e00> origin to: (0.0, -26.0)
IQKeyboardManager|	<<<<< adjustPosition() ended: 0.0005378810019465163 seconds <<<<<
IQKeyboardManager|	⌨️>>>>> keyboardDidShow(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager|	⌨️<<<<< keyboardDidShow(_:) ended: 0.00013294999371282756 seconds <<<<<
IQKeyboardManager|	>>>>> adjustPosition() started >>>>>
IQKeyboardManager|	|	Need to move: 0.0
IQKeyboardManager|	<<<<< adjustPosition() ended: 6.623199442401528e-05 seconds <<<<<
IQKeyboardManager|	⌨️>>>>> keyboardWillHide(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager|	|	Restoring <YACHT_NOW.ChatRoomView: 0x7f9518847e00> origin to: (0.0, 0.0)
IQKeyboardManager|	⌨️<<<<< keyboardWillHide(_:) ended: 0.00037055999564472586 seconds <<<<<
IQKeyboardManager|	📝>>>>> textFieldViewDidEndEditing(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<YACHT_NOW.CustomChatTextField: 0x7f951a09f600; baseClass = UITextView; frame = (10 6; 244 30); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x6000026dcfc0>; backgroundColor = <UIDynamicSystemColor: 0x600003cb61c0; name = systemBackgroundColor>; layer = <CALayer: 0x600002951b80>; contentOffset: {0, 0.33333333333333331}; contentSize: {244, 33}; adjustedContentInset: {0, 0, 0, 0}>
IQKeyboardManager|	📝<<<<< textFieldViewDidEndEditing(_:) ended: 0.00011827600246760994 seconds <<<<<
IQKeyboardManager|	⌨️>>>>> keyboardDidHide(_:) started >>>>>
IQKeyboardManager|	|	Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029

<details>
<summary>英文:</summary>

as the title says, I&#39;m attempting to fix up this project given to me and they use IQSharedKeyboard which from what I&#39;ve read is supposed to be great. The problem is that it doesn&#39;t work, at all. It pushes my top header up whenever it does try to work, and it only shows up on the bottom 2% of the screen, like all I see is the Done toolbar. How can I fix this? Google yields no results, maybe there&#39;s a newer library? My views as far as I&#39;m aware are all scrolling/UIView/UIText views so it really shouldn&#39;t be an issue. I also am not sure why it pushes my top header up, but that&#39;s a separate question for after it actually works.
Debug Code:

IQKeyboardManager| ⌨️>>>>> keyboardWillHide(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| ⌨️<<<<< keyboardWillHide(
IQKeyboardManager Swift Does Not Work At All ended: 0.00040386100590694696 seconds <<<<<
IQKeyboardManager| ⌨️>>>>> keyboardDidHide(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| ⌨️<<<<< keyboardDidHide(
IQKeyboardManager Swift Does Not Work At All ended: 8.349800191354007e-05 seconds <<<<<
IQKeyboardManager| UIKeyboard Frame: (0.0, 808.0, 393.0, 119.0)
IQKeyboardManager| ⌨️>>>>> keyboardWillShow(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| | Saving <YACHT_NOW.ChatRoomView: 0x7f9518847e00> beginning origin: (0.0, 0.0)
IQKeyboardManager| ⌨️<<<<< keyboardWillShow(
IQKeyboardManager Swift Does Not Work At All ended: 0.0001746119960444048 seconds <<<<<
IQKeyboardManager| >>>>> adjustPosition() started >>>>>
IQKeyboardManager| | Need to move: 26.0
IQKeyboardManager| | Moving Upward
IQKeyboardManager| | Set <YACHT_NOW.ChatRoomView: 0x7f9518847e00> origin to: (0.0, -26.0)
IQKeyboardManager| <<<<< adjustPosition() ended: 0.0005378810019465163 seconds <<<<<
IQKeyboardManager| ⌨️>>>>> keyboardDidShow(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| ⌨️<<<<< keyboardDidShow(
IQKeyboardManager Swift Does Not Work At All ended: 0.00013294999371282756 seconds <<<<<
IQKeyboardManager| >>>>> adjustPosition() started >>>>>
IQKeyboardManager| | Need to move: 0.0
IQKeyboardManager| <<<<< adjustPosition() ended: 6.623199442401528e-05 seconds <<<<<
IQKeyboardManager| ⌨️>>>>> keyboardWillHide(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| | Restoring <YACHT_NOW.ChatRoomView: 0x7f9518847e00> origin to: (0.0, 0.0)
IQKeyboardManager| ⌨️<<<<< keyboardWillHide(
IQKeyboardManager Swift Does Not Work At All ended: 0.00037055999564472586 seconds <<<<<
IQKeyboardManager| 📝>>>>> textFieldViewDidEndEditing(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<YACHT_NOW.CustomChatTextField: 0x7f951a09f600; baseClass = UITextView; frame = (10 6; 244 30); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x6000026dcfc0>; backgroundColor = <UIDynamicSystemColor: 0x600003cb61c0; name = systemBackgroundColor>; layer = <CALayer: 0x600002951b80>; contentOffset: {0, 0.33333333333333331}; contentSize: {244, 33}; adjustedContentInset: {0, 0, 0, 0}>
IQKeyboardManager| 📝<<<<< textFieldViewDidEndEditing(
IQKeyboardManager Swift Does Not Work At All ended: 0.00011827600246760994 seconds <<<<<
IQKeyboardManager| ⌨️>>>>> keyboardDidHide(IQKeyboardManager Swift Does Not Work At All started >>>>>
IQKeyboardManager| | Notification Object:<UIScreen: 0x7f9519d04a40; bounds: {{0, 0}, {393, 852}}; mode: <UIScreenMode: 0x6000029f3fa0; size = 1179.000000 x 2556.000000>>
IQKeyboardManager| ⌨️<<<<< keyboardDidHide(
IQKeyboardManager Swift Does Not Work At All ended: 0.00021278900385368615 seconds <<<<<


Code for messaging

extension ChatRoomView : UITextViewDelegate {
func textViewDidBeginEditing(_ textView: UITextView) {
if textView.text == "Type here" {
textView.text = ""
//textView.textColor = UIColor.darkGray
}
}

func textViewDidEndEditing(_ textView: UITextView) {
    if textView.text.isEmpty {
        
        textView.text = &quot;Type here&quot;
        //textView.textColor = UIColor.lightGray
    }
}

}


</details>


# 答案1
**得分**: 0

你可以重新安装 pod -> pod 'IQKeyboardManager'

确保你导入 -> import IQKeyboardManagerSwift,在你的应用的 AppDelegate.swift 文件中

确保你在 AppDelegate.swift 文件的 didFinishLaunchingWithOptions 函数中设置键盘 -> IQKeyboardManager.shared.enable = true

<details>
<summary>英文:</summary>

you can reinstall pod -&gt; pod &#39;IQKeyboardManager&#39; 

make sure you import -&gt; import IQKeyboardManagerSwift , in AppDelegate.swift file in your app

make sure you set keyboard in didFinishLaunchingWithOptions 
 function of AppDelegate.swift -&gt; IQKeyboardManager.shared.enable = true

pod 'IQKeyboardManager'

import IQKeyboardManagerSwift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -&gt; Bool {

  IQKeyboardManager.shared.enable = true

  return true
}

}

huangapple
  • 本文由 发表于 2023年3月9日 17:58:04
  • 转载请务必保留本文链接:https://go.coder-hub.com/75682970.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定