{"id":2565,"url":"https://github.com/michaeltyson/TPKeyboardAvoiding","last_synced_at":"2025-08-03T00:31:56.618Z","repository":{"id":1431053,"uuid":"1614475","full_name":"michaeltyson/TPKeyboardAvoiding","owner":"michaeltyson","description":"A drop-in universal solution for moving text fields out of the way of the keyboard in iOS","archived":false,"fork":false,"pushed_at":"2023-09-15T07:38:59.000Z","size":237,"stargazers_count":5800,"open_issues_count":103,"forks_count":921,"subscribers_count":159,"default_branch":"master","last_synced_at":"2025-07-26T08:27:17.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://atastypixel.com/blog/a-drop-in-universal-solution-for-moving-text-fields-out-of-the-way-of-the-keyboard/","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"vrapper/vrapper","license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaeltyson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-04-14T14:28:29.000Z","updated_at":"2025-07-23T10:07:35.000Z","dependencies_parsed_at":"2022-08-08T07:52:52.619Z","dependency_job_id":"cf8e1162-b21f-4f7d-9c34-6ee5e6af4421","html_url":"https://github.com/michaeltyson/TPKeyboardAvoiding","commit_stats":{"total_commits":169,"total_committers":59,"mean_commits":2.864406779661017,"dds":"0.47337278106508873","last_synced_commit":"3217d6287a6b0ecb1db65a214a2e0fba9934e417"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/michaeltyson/TPKeyboardAvoiding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeltyson%2FTPKeyboardAvoiding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeltyson%2FTPKeyboardAvoiding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeltyson%2FTPKeyboardAvoiding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeltyson%2FTPKeyboardAvoiding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaeltyson","download_url":"https://codeload.github.com/michaeltyson/TPKeyboardAvoiding/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeltyson%2FTPKeyboardAvoiding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267168757,"owners_count":24046707,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-01-05T20:16:17.030Z","updated_at":"2025-08-03T00:31:56.337Z","avatar_url":"https://github.com/michaeltyson.png","language":"Objective-C","readme":"TPKeyboardAvoiding\n==================\n\nA drop-in universal solution for moving text fields out of the way of the keyboard in iOS.\n\nIntroduction\n------------\n\nThere are a hundred and one proposed solutions out there for how to move `UITextField` and `UITextView` out of the way of the keyboard during editing -- usually, it comes down to observing `UIKeyboardWillShowNotification` and `UIKeyboardWillHideNotification`, or implementing `UITextFieldDelegate` delegate methods, and adjusting the frame of the superview, or using `UITableView`'s `scrollToRowAtIndexPath:atScrollPosition:animated:`, but most proposed solutions tend to be quite DIY, and have to be implemented for each view controller that needs it.\n\nThis is a relatively universal, drop-in solution: `UIScrollView` and `UITableView` subclasses that handle everything.\n\nWhen the keyboard is about to appear, the subclass will find the subview that's about to be edited, and adjust its frame and content offset to make sure that view is visible, with an animation to match the keyboard pop-up. When the keyboard disappears, it restores its prior size.\n\nIt should work with basically any setup, either a UITableView-based interface, or one consisting of views placed manually.\n\nIt also automatically hooks up \"Next\" buttons on the keyboard to switch through the text fields.\n\nUsage\n-----\n\nFor use with `UITableViewController` classes, drop `TPKeyboardAvoidingTableView.m` and `TPKeyboardAvoidingTableView.h` into your project, and make your UITableView a `TPKeyboardAvoidingTableView` in the xib.  If you're not using a xib with your controller, I know of no easy way to make its UITableView a custom class: The path of least resistance is to create a xib for it.\n\nFor non-UITableViewControllers, drop the `TPKeyboardAvoidingScrollView.m` and `TPKeyboardAvoidingScrollView.h` source files into your project, pop a `UIScrollView` into your view controller's xib, set the scroll view's class to `TPKeyboardAvoidingScrollView`, and put all your controls within that scroll view.  You can also create it programmatically, without using a xib - just use the TPKeyboardAvoidingScrollView as your top-level view.\n\nTo disable the automatic \"Next\" button functionality, change the UITextField's return key type to anything but UIReturnKeyDefault.\n\nNotes\n-----\n\nThese classes currently adjust the contentInset parameter to avoid content moving beneath the keyboard.  This is done, as opposed to adjusting the frame, in order to work around an iOS bug that results in a jerky animation where the view jumps upwards, before settling down.  In order to facilitate this workaround, the contentSize is maintained to be at least same size as the view's frame.\n\nLicence (Zlib)\n--------------\n\nCopyright (c) 2013 Michael Tyson\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n   claim that you wrote the original software. If you use this software\n   in a product, an acknowledgment in the product documentation would be\n   appreciated but is not required.\n\n2. Altered source versions must be plainly marked as such, and must not be\n   misrepresented as being the original software.\n\n3. This notice may not be removed or altered from any source\n   distribution.\n\n\n------------\n\nMichael Tyson, A Tasty Pixel  \nmichael@atastypixel.com\n","funding_links":[],"categories":["UI","Objective-C","Objective-C  Stars 1000以内排名整理","UI Components","etc"],"sub_categories":["Keyboard","Other free courses"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeltyson%2FTPKeyboardAvoiding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeltyson%2FTPKeyboardAvoiding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeltyson%2FTPKeyboardAvoiding/lists"}