{"id":21065072,"url":"https://github.com/prolificinteractive/iqkeyboardmanager","last_synced_at":"2025-03-14T01:43:23.584Z","repository":{"id":147516548,"uuid":"44981656","full_name":"prolificinteractive/IQKeyboardManager","owner":"prolificinteractive","description":null,"archived":false,"fork":false,"pushed_at":"2015-10-26T16:28:31.000Z","size":15712,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-20T20:53:37.066Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prolificinteractive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-26T16:27:12.000Z","updated_at":"2021-05-18T16:50:35.000Z","dependencies_parsed_at":"2023-04-11T04:53:50.836Z","dependency_job_id":null,"html_url":"https://github.com/prolificinteractive/IQKeyboardManager","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2FIQKeyboardManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2FIQKeyboardManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2FIQKeyboardManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2FIQKeyboardManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prolificinteractive","download_url":"https://codeload.github.com/prolificinteractive/IQKeyboardManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243508983,"owners_count":20302106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T17:53:22.729Z","updated_at":"2025-03-14T01:43:23.557Z","avatar_url":"https://github.com/prolificinteractive.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/KeyboardTextFieldDemo/KeyboardTextFieldDemo/icon.png\" alt=\"Icon\"/\u003e\n\u003c/p\u003e\n\u003cH1 align=\"center\"\u003eIQKeyboardManager\u003c/H1\u003e\n\nOften 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.\n\n####Key Features\n\n1) **CODELESS**, Zero Line Of Code`\n\n2) `Works Automatically`\n\n3) `No More UIScrollView`\n\n4) `No More Subclasses`\n\n5) `No More Manual Work`\n\n6) `No More #imports`\n\n`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.\n\n####Recent Blog about IQKeyboardManager\nhttp://www.theothertomelliott.com/node/1124\n\n## Screenshot\n[![IQKeyboardManager](./KeyboardTextFieldDemo/Screenshot/IQKeyboardManagerScreenshot.png)](http://youtu.be/6nhLw6hju2A)\n[![Settings](./KeyboardTextFieldDemo/Screenshot/IQKeyboardManagerSettings.png)](http://youtu.be/6nhLw6hju2A)\n\n## GIF animation\n[![IQKeyboardManager](./KeyboardTextFieldDemo/Screenshot/IQKeyboardManager.gif)](http://youtu.be/6nhLw6hju2A)\n\n## Video\n\n\u003ca href=\"http://youtu.be/WAYc2Qj-OQg\" target=\"_blank\"\u003e\u003cimg src=\"http://img.youtube.com/vi/WAYc2Qj-OQg/0.jpg\" \nalt=\"IQKeyboardManager Demo Video\" width=\"480\" height=\"360\" border=\"10\" /\u003e\u003c/a\u003e\n\n## Requirements\n\n#### IQKeyboardManager:-\n\nMinimum iOS Target: iOS 5.0\n\nMinimum Xcode Version: Xcode 5.0\n\n#### Demo Project:-\n\nMinimum Xcode Version: Xcode 6.0\n\n\nInstallation\n==========================\n\n#### Cocoapod Method:-\n\nIQKeyboardManager is available through [CocoaPods](http://cocoapods.org), to install\nit simply add the following line to your Podfile: ([#9](https://github.com/hackiftekhar/IQKeyboardManager/issues/9))\n\n    pod 'IQKeyboardManager'\n\n#### Source Code Method:-\n\nJust ***drag and drop*** `IQKeyBoardManager` directory from demo project to your project. That's it.\n\n## Known Issues:-\n\n![Known Issue 1](./KeyboardTextFieldDemo/Screenshot/IQKeyboardManagerKnownIssue1.png)\n\n####1) Keyboard does not appear in iOS Simulator ([#62](https://github.com/hackiftekhar/IQKeyboardManager/issues/62), [#72](https://github.com/hackiftekhar/IQKeyboardManager/issues/72), [#75](https://github.com/hackiftekhar/IQKeyboardManager/issues/75), [#90](https://github.com/hackiftekhar/IQKeyboardManager/issues/90), [#100](https://github.com/hackiftekhar/IQKeyboardManager/issues/100))\n     \nIf keyboard does not appear in iOS Simulator and only toolbar is appearing over it (if enableAutoToolbar = YES), then check this setting\n     \n***Xcode 6:-*** Goto ***iOS Simulator-\u003eMenu-\u003eHardware-\u003eKeyboard-\u003eConnect Hardware Keyboard***, and deselect that.\n\n***Xcode 5 and earlier:-*** Goto ***iOS Simulator-\u003eMenu-\u003eHardware-\u003eSimulate Hardware Keyboard***, and deselect that.\n    \n####2) setEnable = NO doesn't disable automatic UIToolbar ([#117](https://github.com/hackiftekhar/IQKeyboardManager/issues/117), [#136](https://github.com/hackiftekhar/IQKeyboardManager/issues/136), [#147](https://github.com/hackiftekhar/IQKeyboardManager/issues/147))\n\nIf you set ***[[IQKeyboardManager sharedManager] setEnable:NO]*** and still automatic toolbar appears on textFields? Probably you haven't heard about ***@property enableAutoToolbar***.\n\n***@property enable :*** It enable/disable managing distance between keyboard and textField, and doesn't affect autoToolbar feature.\n\n***@property enableAutoToolbar :*** It enable/disable automatic creation of toolbar, please set enableAutoToolbar to NO if you don't want to add automatic toolbar.\n\n####3) Swift version crashes in Release Mode ([#111](https://github.com/hackiftekhar/IQKeyboardManager/issues/111))\n\nIt may be compiler issue when compiler tries to optimize Code for best performance and compiler changes something in the middle which is not expected. Changing **Optimization Level** in Build Settings solve the problem.\n\n**Workdaround:** Goto ***Target-\u003eBuild Settings-\u003eCode Generation-\u003eOptimization Level***, and set it to ***None[-O0]***.([StackOverflow](http://stackoverflow.com/questions/3327981/app-runs-as-debug-but-crashes-as-release))\n\n\nManual Management:-\n---\n\n#### UINavigationBar:-\n\n  If you don't want to hide the default UINavigationBar of UINavigationController when keyboardManager slides up the view, then just change the UIView class to UIScrollView from the storyboard or xib.([#21](https://github.com/hackiftekhar/IQKeyboardManager/issues/21), [#24](https://github.com/hackiftekhar/IQKeyboardManager/issues/24))\n\n![image](./KeyboardTextFieldDemo/Screenshot/UINavigationBarExample.png)\n\n\n  If you are not using storyboard or xib and creating your view programmatically. Then you need to override '-(void)loadView' method of UIViewController, and need to set an UIScrollView instance to self.view.\n\n    -(void)loadView\n    {\n        UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];\n        self.view = scrollView;\n    }\n \n#### Disable for a ViewController:-\n\n If you would like to disable `IQKeyboardManager` for a particular ViewController then register ViewController with `-(void)disableInViewControllerClass:(Class)disabledClass` method in AppDelegate.([#117](https://github.com/hackiftekhar/IQKeyboardManager/issues/117),[#139](https://github.com/hackiftekhar/IQKeyboardManager/issues/139))\n\n```\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    [[IQKeyboardManager sharedManager] disableInViewControllerClass:[ViewController class]];\n    return YES;\n}\n```\n\n#### Disable toolbar for a ViewController:-\n\nIf you would like to disable `Auto Toolbar` for a particular ViewController then register ViewController with `-(void)disableToolbarInViewControllerClass:(Class)disabledClass` method in AppDelegate.\n\n```\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    [[IQKeyboardManager sharedManager] disableToolbarInViewControllerClass:[ViewController class]];\n    return YES;\n}\n```\n\n#### Considering Previous/Next buttons for textField inside customViews:-\n\nIf your textFields are on different customView and do not show previous/next to navigate between textField. Then you should create a SpecialView subclass of UIView, then put all customView inside SpecialView, then register SpecialView class using `-(void)considerToolbarPreviousNextInViewClass:(Class)toolbarPreviousNextConsideredClass` method in AppDelegate.([#154](https://github.com/hackiftekhar/IQKeyboardManager/issues/154), [#179](https://github.com/hackiftekhar/IQKeyboardManager/issues/179))\n\n```\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n{\n    [[IQKeyboardManager sharedManager] considerToolbarPreviousNextInViewClass:[SpecialView class]];\n    return YES;\n}\n```\n\n#### Keyboard Return Key Handling:-\n  If you would like to implement keyboard **Return Key** as **Next/Done** button, then you can use **IQKeyboardReturnKeyHandler**.([#38](https://github.com/hackiftekhar/IQKeyboardManager/issues/38), [#63](https://github.com/hackiftekhar/IQKeyboardManager/issues/63))\n  \n  1) Create an instance variable of `IQKeyboardReturnKeyHandler` and instantiate it in `viewDidLoad` with ViewController object like this:-\n  \n```\n@implementation ViewController\n{\n    IQKeyboardReturnKeyHandler *returnKeyHandler;\n}\n\n- (void)viewDidLoad\n{\n    [super viewDidLoad];\n    \n    returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController:self];\n}\n```\n   It assign all the responderView delegates to self, and change keybord Return Key to Next key.\n\n2) set instance variable to nil in `dealloc` method.\n\n```\n-(void)dealloc\n{\n    returnKeyHandler = nil;\n}\n```\n\n\n#### UIToolbar(IQToolbar):-\n\n1) If you don't want to add automatic toolbar over keyboard for a specific textField then you should add a UIView as it's toolbar like this:-([#89](https://github.com/hackiftekhar/IQKeyboardManager/issues/89))\n```\ntextField.inputAccessoryView = [[UIView alloc] init];\n```\n\n2) If you need your own control over the previous/next/done button then you should use the UIView category methods to add toolbar over your textField. The UIView category methods are defined in `IQUIView+IQKeyboardToolbar.h` file. You can use them like this:-([#40](https://github.com/hackiftekhar/IQKeyboardManager/issues/40))\n```\n-(void)viewDidLoad\n{\n    [super viewDidLoad];\n    \n    //Adding done button for textField1\n    [textField1 addDoneOnKeyboardWithTarget:self action:@selector(doneAction:)];\n    \n    //Adding previous/next/done button for textField2\n    [textField2 addPreviousNextDoneOnKeyboardWithTarget:self previousAction:@selector(previousAction:) nextAction:@selector(nextAction:) doneAction:@selector(doneAction:)];\n    \n    //Adding cancel/done button for textField3\n    [textField3 addCancelDoneOnKeyboardWithTarget:self cancelAction:@selector(cancelAction:) doneAction:@selector(doneAction:)];\n}\n\n/*!\tpreviousAction. */\n-(void)previousAction:(id)button\n{\n    //previousAction\n}\n\n/*!\tnextAction. */\n-(void)nextAction:(id)button\n{\n    //nextAction\n}\n\n/*!\tdoneAction. */\n-(void)doneAction:(UIBarButtonItem*)barButton\n{\n    //doneAction\n}\n\n/*!\tcancelAction. */\n-(void)cancelAction:(UIBarButtonItem*)barButton\n{\n    //cancelAction\n}\n\n```\n\n#### Doing custom work on textField with returning NO in `textFieldShouldBeginEditing:` delegate:-\n\nGenerally if developer need to perform some custom task on a particular textField click, then usually developer write their custom code inside ***textFieldShouldBeginEditing:*** and returning NO for that textField. But if you are using IQKeyboardManager, then IQKeyboardManager also asks textField to recognize it can become first responder or not using ***canBecomeFirstResponder*** in `IQUIView+Hierarchy` category, and textField asks it's delegate to respond from `textFieldShouldBeginEditing:`, so this method is called for each textField everytime when a textField becomeFirstResponder. Unintentionally custom code runs multiple times even when we do not touch the textField to become it as first responder. To overcome this situation please use ***isAskingCanBecomeFirstResponder*** BOOL property to check that the delegate is called by IQKeyboardManager or not. ([#88](https://github.com/hackiftekhar/IQKeyboardManager/issues/88))\n\n1) You may need to import `IQUIView+Hierarchy` category\n```\n#import \"IQUIView+Hierarchy.h\"\n```\n\n2) check for ***isAskingCanBecomeFirstResponder*** in `textFieldShouldBeginEditing:` delegate.\n\n```\n-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField\n{\n    if (textField == customWorkTextField)\n    {\n        if (textField.isAskingCanBecomeFirstResponder == NO)\n        {\n            //Do your work on tapping textField.\n            [[[UIAlertView alloc] initWithTitle:@\"IQKeyboardManager\" message:@\"Do your custom work here\" delegate:nil cancelButtonTitle:@\"OK\" otherButtonTitles:nil, nil] show];\n        }\n\n        return NO;\n    }\n    else    return YES;\n}\n```\n\n## Control Flow Diagram\n[![IQKeyboardManager CFD](./KeyboardTextFieldDemo/Screenshot/IQKeyboardManagerCFD.jpg)](https://raw.githubusercontent.com/hackiftekhar/IQKeyboardManager/master/KeyboardTextFieldDemo/Screenshot/IQKeyboardManagerCFD.jpg)\n\n\n##Properties and functions usage:-\n\n\n####UIKeyboard handling\n\n***+(instancetype)sharedManager :***\nReturns the default singleton instance.\n\n***@property BOOL enable :***\nUse this to enable/disable managing distance between keyboard \u0026 textField/textView).\n\n***@property CGFloat keyboardDistanceFromTextField :***\nSet Distance between keyboard \u0026 textField. Can't be less than zero. Default is 10.\n\n***@property BOOL preventShowingBottomBlankSpace :***\nPrevent to show bottom blanck area when keyboard slide up the view. Default is YES. ([#93](https://github.com/hackiftekhar/IQKeyboardManager/issues/93)).\n\n####IQToolbar handling\n\n***@property BOOL enableAutoToolbar :***\nEnable autoToolbar behaviour. If It is set to NO. You have to manually create UIToolbar for keyboard. Default is YES.\n\n***@property IQAutoToolbarManageBehaviour toolbarManageBehaviour :***\nSetting toolbar behaviour to IQAutoToolbarBySubviews to manage previous/next according to UITextField's hierarchy in it's SuperView. Set it to IQAutoToolbarByTag to manage previous/next according to UITextField's tag property in increasing order. Default is IQAutoToolbarBySubviews.\n\n***@property  BOOL shouldToolbarUsesTextFieldTintColor :***\nIf YES, then uses textField's tintColor property for IQToolbar, otherwise tintColor is black. Default is NO. ([#27](https://github.com/hackiftekhar/IQKeyboardManager/issues/27))\n\n***@property BOOL shouldShowTextFieldPlaceholder :***\nIf YES, then it add the textField's placeholder text on IQToolbar. Default is YES. ([#27](https://github.com/hackiftekhar/IQKeyboardManager/issues/27))\n\n***@property UIFont *placeholderFont :***\nplaceholder Font. Default is nil. ([#27](https://github.com/hackiftekhar/IQKeyboardManager/issues/27))\n\n\n####UITextView handling\n\n***@property BOOL canAdjustTextView :***\nGiving permission to modify TextView's frame. Adjust textView's frame when it is too big in height. Default is NO. ([#30](https://github.com/hackiftekhar/IQKeyboardManager/issues/30))\n\n***@property BOOL shouldFixTextViewClip :***\nAdjust textView's contentInset to fix fix for iOS 7.0.x -([#Stackoverflow](http://stackoverflow.com/questions/18966675/uitextview-in-ios7-clips-the-last-line-of-text-string)). Default is YES.\n\n\n####UIKeyboard Appearance overriding\n\n***@property BOOL overrideKeyboardAppearance :***\nOverride the keyboardAppearance for all textField/textView. Default is NO.\n\n***@property UIKeyboardAppearance keyboardAppearance :***\nIf overrideKeyboardAppearance is YES, then all the textField keyboardAppearance is set using this property.\n\n\n####UITextField/UITextView Resign handling\n\n***@property BOOL shouldResignOnTouchOutside :***\nResign textField if touched outside of UITextField/UITextView. ([#14](https://github.com/hackiftekhar/IQKeyboardManager/issues/14))\n\n***-(void)resignFirstResponder :***\nResigns currently first responder field.\n\n####UISound handling\n\n***@property BOOL shouldPlayInputClicks :***\nIf YES, then it plays inputClick sound on next/previous/done click. Default is NO.\n\n\n####UIAnimation handling\n\n***@property BOOL shouldAdoptDefaultKeyboardAnimation :***\nIf YES, then uses keyboard default animation curve style to move view, otherwise uses UIViewAnimationOptionCurveEaseOut animation style. Default is YES.\n\n\n\n## Feature:-\n\n 1) Support Device Orientation.\n \n 2) Enable/Disable Keyboard Manager when needed with `enable` boolean.\n\n 3) Easiest integration.\n\n 4) AutoHandle UIToolbar as a accessoryInputView of textField/textView with `enableAutoToolbar` boolean.\n\n 5) AutoHandle UIToolbar can be manged by superview's hierarchy or can be managed by tag property of textField/textView using `toolbarManageBehaviour` enum.\n\n 6) `UIView` Category for easily adding Next/Previous and Done button as Keyboard UIToolBar, even automatic with `enableAutoToolbar` boolean.\n\n 7) Enable/Disable Next/Previous buttons with Category methods, even automatic with `enableAutoToolbar` boolean.\n\n 8) Set keyboard distance from textFields using `keyboardDistanceFromTextField`.\n \n 9) Resign keyboard on touching outside using `shouldResignOnTouchOutside`.\n \n 10) Manage UITextView's frame when it's hight is too large to fit on screen with `canAdjustTextView` boolean.\n \n 11) Can manage `UITextField/UITextView` inside `UITableView/UIScrollView`.\n \n 12) Can play input sound on Next/Previous/Done click.\n\nLICENSE\n---\nDistributed under the MIT License.\n\nContributions\n---\nAny contribution is more than welcome! You can contribute through pull requests and issues on GitHub.\n\nAuthor\n---\nIf you wish to contact me, email at: hack.iftekhar@gmail.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprolificinteractive%2Fiqkeyboardmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprolificinteractive%2Fiqkeyboardmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprolificinteractive%2Fiqkeyboardmanager/lists"}