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.

210 lines
8.9 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. Often while developing an app, We ran into an issues where the iPhone keyboard slide up and cover the `UITextField/UITextView`. `IQKeyboardManager` allows you to prevent issues of the keyboard sliding up and cover `UITextField/UITextView` without needing you to enter any code and no additional setup required. 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. There are also nice optional features allowing you to customize the distance from the text field, add the next/previous done button as a keyboard UIToolbar, play sounds when the user navigations 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 wants to handle UITextField/UITextView with IQKeyboardManager then you're totally going on 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 implemented their custom solution to handle UITextField/UITextView thought 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 9.3 |
  41. **Note**
  42. - 3.3.7 is the last iOS 7 supported version.
  43. #### Swift versions support
  44. | Swift | Xcode | IQKeyboardManagerSwift |
  45. |-------------------|-------|------------------------|
  46. | 4.2, 4.0, 3.2, 3.0| 10.0 | >= 6.0.4 |
  47. | 4.0, 3.2, 3.0 | 9.0 | 5.0.0 |
  48. | 3.1 | 8.3 | 4.0.10 |
  49. | 3.0 (3.0.2) | 8.2 | 4.0.8 |
  50. | 2.2 or 2.3 | 7.3 | 4.0.5 |
  51. | 2.1.1 | 7.2 | 4.0.0 |
  52. | 2.1 | 7.2 | 3.3.7 |
  53. | 2.0 | 7.0 | 3.3.3.1 |
  54. | 1.2 | 6.3 | 3.3.1 |
  55. | 1.0 | 6.0 | 3.3.2 |
  56. Installation
  57. ==========================
  58. #### Installation with CocoaPods
  59. [![CocoaPods](https://img.shields.io/cocoapods/v/IQKeyboardManager.svg)](http://cocoadocs.org/docsets/IQKeyboardManager)
  60. ***IQKeyboardManager (Objective-C):*** IQKeyboardManager is available through [CocoaPods](http://cocoapods.org), to install
  61. it simply add the following line to your Podfile: ([#9](https://github.com/hackiftekhar/IQKeyboardManager/issues/9))
  62. ```ruby
  63. pod 'IQKeyboardManager' #iOS8 and later
  64. pod 'IQKeyboardManager', '3.3.7' #iOS7
  65. ```
  66. ***IQKeyboardManager (Swift):*** IQKeyboardManagerSwift is available through [CocoaPods](http://cocoapods.org), to install
  67. it simply add the following line to your Podfile: ([#236](https://github.com/hackiftekhar/IQKeyboardManager/issues/236))
  68. *Swift 4.2, 4.0, 3.2, 3.0 (Xcode 9)*
  69. ```ruby
  70. pod 'IQKeyboardManagerSwift'
  71. ```
  72. *Or you can choose version you need based on Swift support table from [Requirements](README.md#requirements)*
  73. ```ruby
  74. pod 'IQKeyboardManagerSwift', '5.0.0'
  75. ```
  76. In AppDelegate.swift, just import IQKeyboardManagerSwift framework and enable IQKeyboardManager.
  77. ```swift
  78. import IQKeyboardManagerSwift
  79. @UIApplicationMain
  80. class AppDelegate: UIResponder, UIApplicationDelegate {
  81. var window: UIWindow?
  82. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  83. IQKeyboardManager.shared.enable = true
  84. return true
  85. }
  86. }
  87. ```
  88. #### Installation with Carthage
  89. [Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
  90. You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
  91. ```bash
  92. $ brew update
  93. $ brew install carthage
  94. ```
  95. To integrate `IQKeyboardManger` or `IQKeyboardManagerSwift` into your Xcode project using Carthage, specify it in your `Cartfile`:
  96. ```ogdl
  97. github "hackiftekhar/IQKeyboardManager"
  98. ```
  99. Run `carthage` to build the frameworks and drag the appropriate framework (`IQKeyboardManager.framework` or `IQKeyboardManagerSwift.framework`) into your Xcode project according to your need. Make sure to add only one framework and not both.
  100. #### Installation with Source Code
  101. [![Github tag](https://img.shields.io/github/tag/hackiftekhar/iqkeyboardmanager.svg)]()
  102. ***IQKeyboardManager (Objective-C):*** Just ***drag and drop*** `IQKeyboardManager` directory from demo project to your project. That's it.
  103. ***IQKeyboardManager (Swift):*** ***Drag and drop*** `IQKeyboardManagerSwift` directory from demo project to your project
  104. In AppDelegate.swift, just enable IQKeyboardManager.
  105. ```swift
  106. @UIApplicationMain
  107. class AppDelegate: UIResponder, UIApplicationDelegate {
  108. var window: UIWindow?
  109. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
  110. IQKeyboardManager.shared.enable = true
  111. return true
  112. }
  113. }
  114. ```
  115. Migration Guide
  116. ==========================
  117. - [IQKeyboardManager 6.0.0 Migration Guide](https://github.com/hackiftekhar/IQKeyboardManager/wiki/IQKeyboardManager-6.0.0-Migration-Guide)
  118. Other Links
  119. ==========================
  120. - [Known Issues](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Known-Issues)
  121. - [Manual Management Tweaks](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Manual-Management)
  122. - [Properties and functions usage](https://github.com/hackiftekhar/IQKeyboardManager/wiki/Properties-&-Functions)
  123. ## Flow Diagram
  124. [![IQKeyboardManager CFD](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/Screenshot/IQKeyboardManagerFlowDiagram.jpg)
  125. If you would like to see detailed Flow diagram then see [Detailed Flow Diagram](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/v3.3.0/Screenshot/IQKeyboardManagerCFD.jpg).
  126. LICENSE
  127. ---
  128. Distributed under the MIT License.
  129. Contributions
  130. ---
  131. Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.
  132. Author
  133. ---
  134. If you wish to contact me, email at: hack.iftekhar@gmail.com