You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
9.0 KiB

  1. <p align="center">
  2. <img src="https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Demo/Resources/icon.png" alt="Icon"/>
  3. </p>
  4. <H1 align="center">IQKeyboardManager</H1>
  5. <p align="center">
  6. <img src="https://img.shields.io/github/license/hackiftekhar/IQKeyboardManager.svg"
  7. alt="GitHub license"/>
  8. [![Build Status](https://travis-ci.org/hackiftekhar/IQKeyboardManager.svg)](https://travis-ci.org/hackiftekhar/IQKeyboardManager)
  9. While developing iOS apps, we often run into issues where the iPhone keyboard slides up and covers the `UITextField/UITextView`. `IQKeyboardManager` allows you to prevent this issue of keyboard sliding up and covering `UITextField/UITextView` without needing you to write any code or make any additional setup. To use `IQKeyboardManager` you simply need to add source files to your project.
  10. #### Key Features
  11. 1) `**CODELESS**, Zero Lines of Code`
  12. 2) `Works Automatically`
  13. 3) `No More UIScrollView`
  14. 4) `No More Subclasses`
  15. 5) `No More Manual Work`
  16. 6) `No More #imports`
  17. `IQKeyboardManager` works on all orientations, and with the toolbar. It also has nice optional features allowing you to customize the distance from the text field, behaviour of previous, next and done buttons in the keyboard toolbar, play sound when the user navigates through the form and more.
  18. ## Screenshot
  19. [![IQKeyboardManager](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerScreenshot.png)](http://youtu.be/6nhLw6hju2A)
  20. [![Settings](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerSettings.png)](http://youtu.be/6nhLw6hju2A)
  21. ## GIF animation
  22. [![IQKeyboardManager](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManager.gif)](http://youtu.be/6nhLw6hju2A)
  23. ## Video
  24. <a href="http://youtu.be/WAYc2Qj-OQg" target="_blank"><img src="http://img.youtube.com/vi/WAYc2Qj-OQg/0.jpg"
  25. alt="IQKeyboardManager Demo Video" width="480" height="360" border="10" /></a>
  26. ## Tutorial video by @rebeloper ([#1135](https://github.com/hackiftekhar/IQKeyboardManager/issues/1135))
  27. @rebeloper demonstrated two videos on how to implement **IQKeyboardManager** at it's core:
  28. <a href="https://www.youtube.com/playlist?list=PL_csAAO9PQ8aTL87XnueOXi3RpWE2m_8v" target="_blank"><img src="https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/ThirdPartyYoutubeTutorial.jpg"
  29. alt="Youtube Tutorial Playlist"/></a>
  30. https://www.youtube.com/playlist?list=PL_csAAO9PQ8aTL87XnueOXi3RpWE2m_8v
  31. ## Warning
  32. - **If you're planning to build SDK/library/framework and want to handle UITextField/UITextView with IQKeyboardManager then you're totally going the wrong way.** I would never suggest to add **IQKeyboardManager** as **dependency/adding/shipping** with any third-party library. Instead of adding **IQKeyboardManager** you should implement your own solution to achieve same kind of results. **IQKeyboardManager** is totally designed for projects to help developers for their convenience, it's not designed for **adding/dependency/shipping** with any **third-party library**, because **doing this could block adoption by other developers for their projects as well (who are not using IQKeyboardManager and have implemented their custom solution to handle UITextField/UITextView in the project).**
  33. - If **IQKeyboardManager** conflicts with other **third-party library**, then it's **developer responsibility** to **enable/disable IQKeyboardManager** when **presenting/dismissing** third-party library UI. Third-party libraries are not responsible to handle IQKeyboardManager.
  34. ## Requirements
  35. [![Platform iOS](https://img.shields.io/badge/Platform-iOS-blue.svg?style=fla)]()
  36. | | Language | Minimum iOS Target | Minimum Xcode Version |
  37. |------------------------|----------|--------------------|-----------------------|
  38. | IQKeyboardManager | Obj-C | iOS 8.0 | Xcode 8.2.1 |
  39. | IQKeyboardManagerSwift | Swift | iOS 8.0 | Xcode 8.2.1 |
  40. | Demo Project | | | Xcode 10.2 |
  41. **Note**
  42. - 3.3.7 is the last iOS 7 supported version.
  43. #### Swift versions support
  44. | Swift | Xcode | IQKeyboardManagerSwift |
  45. |-------------------|-------|------------------------|
  46. | 5.0,4.2, 4.0, 3.2, 3.0| 10.2 | >= 6.2.1 |
  47. | 4.2, 4.0, 3.2, 3.0| 10.0 | >= 6.0.4 |
  48. | 4.0, 3.2, 3.0 | 9.0 | 5.0.0 |
  49. | 3.1 | 8.3 | 4.0.10 |
  50. | 3.0 (3.0.2) | 8.2 | 4.0.8 |
  51. | 2.2 or 2.3 | 7.3 | 4.0.5 |
  52. | 2.1.1 | 7.2 | 4.0.0 |
  53. | 2.1 | 7.2 | 3.3.7 |
  54. | 2.0 | 7.0 | 3.3.3.1 |
  55. | 1.2 | 6.3 | 3.3.1 |
  56. | 1.0 | 6.0 | 3.3.2 |
  57. Installation
  58. ==========================
  59. #### Installation with CocoaPods
  60. [![CocoaPods](https://img.shields.io/cocoapods/v/IQKeyboardManager.svg)](http://cocoadocs.org/docsets/IQKeyboardManager)
  61. ***IQKeyboardManager (Objective-C):*** IQKeyboardManager is available through [CocoaPods](http://cocoapods.org). To install
  62. it, simply add the following line to your Podfile: ([#9](https://github.com/hackiftekhar/IQKeyboardManager/issues/9))
  63. ```ruby
  64. pod 'IQKeyboardManager' #iOS8 and later
  65. pod 'IQKeyboardManager', '3.3.7' #iOS7
  66. ```
  67. ***IQKeyboardManager (Swift):*** IQKeyboardManagerSwift is available through [CocoaPods](http://cocoapods.org). To install
  68. it, simply add the following line to your Podfile: ([#236](https://github.com/hackiftekhar/IQKeyboardManager/issues/236))
  69. *Swift 5.0,4.2, 4.0, 3.2, 3.0 (Xcode 10.2)*
  70. ```ruby
  71. pod 'IQKeyboardManagerSwift'
  72. ```
  73. *Or you can choose the version you need based on Swift support table from [Requirements](README.md#requirements)*
  74. ```ruby
  75. pod 'IQKeyboardManagerSwift', '6.3.0'
  76. ```
  77. In AppDelegate.swift, just import IQKeyboardManagerSwift framework and enable IQKeyboardManager.
  78. ```swift
  79. import IQKeyboardManagerSwift
  80. @UIApplicationMain
  81. class AppDelegate: UIResponder, UIApplicationDelegate {
  82. var window: UIWindow?
  83. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  84. IQKeyboardManager.shared.enable = true
  85. return true
  86. }
  87. }
  88. ```
  89. #### Installation with Carthage
  90. [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
  91. You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
  92. ```bash
  93. $ brew update
  94. $ brew install carthage
  95. ```
  96. To integrate `IQKeyboardManger` or `IQKeyboardManagerSwift` into your Xcode project using Carthage, add the following line to your `Cartfile`:
  97. ```ogdl
  98. github "hackiftekhar/IQKeyboardManager"
  99. ```
  100. Run `carthage` to build the frameworks and drag the appropriate framework (`IQKeyboardManager.framework` or `IQKeyboardManagerSwift.framework`) into your Xcode project based on your need. Make sure to add only one framework and not both.
  101. #### Installation with Source Code
  102. [![Github tag](https://img.shields.io/github/tag/hackiftekhar/iqkeyboardmanager.svg)]()
  103. ***IQKeyboardManager (Objective-C):*** Just ***drag and drop*** `IQKeyboardManager` directory from demo project to your project. That's it.
  104. ***IQKeyboardManager (Swift):*** ***Drag and drop*** `IQKeyboardManagerSwift` directory from demo project to your project
  105. In AppDelegate.swift, just enable IQKeyboardManager.
  106. ```swift
  107. @UIApplicationMain
  108. class AppDelegate: UIResponder, UIApplicationDelegate {
  109. var window: UIWindow?
  110. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  111. IQKeyboardManager.shared.enable = true
  112. return true
  113. }
  114. }
  115. ```
  116. Migration Guide
  117. ==========================
  118. - [IQKeyboardManager 6.0.0 Migration Guide](https://github.com/hackiftekhar/IQKeyboardManager/wiki/IQKeyboardManager-6.0.0-Migration-Guide)
  119. Other Links
  120. ==========================
  121. - [Known Issues](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Known-Issues)
  122. - [Manual Management Tweaks](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Manual-Management)
  123. - [Properties and functions usage](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Properties-&-Functions)
  124. ## Flow Diagram
  125. [![IQKeyboardManager CFD](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)
  126. If you would like to see detailed Flow diagram then check [Detailed Flow Diagram](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerCFD.jpg).
  127. LICENSE
  128. ---
  129. Distributed under the MIT License.
  130. Contributions
  131. ---
  132. Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.
  133. Author
  134. ---
  135. If you wish to contact me, email at: hack.iftekhar@gmail.com