{"id":16682297,"url":"https://github.com/jpsim/jpskeyboardlayoutguide","last_synced_at":"2025-08-16T01:05:49.590Z","repository":{"id":15416801,"uuid":"18149007","full_name":"jpsim/JPSKeyboardLayoutGuide","owner":"jpsim","description":"Easily make your Auto Layout view controllers keyboard aware","archived":false,"fork":false,"pushed_at":"2017-03-07T15:42:17.000Z","size":21,"stargazers_count":69,"open_issues_count":0,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-22T04:46:59.154Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"jpsim.com/keyboard-layout-guide","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"CMS-HTT/Jet2TauFakes","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpsim.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}},"created_at":"2014-03-26T18:28:40.000Z","updated_at":"2023-05-15T19:27:20.000Z","dependencies_parsed_at":"2022-08-25T13:31:50.199Z","dependency_job_id":null,"html_url":"https://github.com/jpsim/JPSKeyboardLayoutGuide","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jpsim/JPSKeyboardLayoutGuide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FJPSKeyboardLayoutGuide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FJPSKeyboardLayoutGuide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FJPSKeyboardLayoutGuide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FJPSKeyboardLayoutGuide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpsim","download_url":"https://codeload.github.com/jpsim/JPSKeyboardLayoutGuide/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpsim%2FJPSKeyboardLayoutGuide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270653574,"owners_count":24622789,"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-08-15T02:00:12.559Z","response_time":110,"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-10-12T14:06:57.820Z","updated_at":"2025-08-16T01:05:49.567Z","avatar_url":"https://github.com/jpsim.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JPSKeyboardLayoutGuide\n\n`JPSKeyboardLayoutGuide` lets you easily make your autolayout view controllers keyboard aware. Think of it as `bottomLayoutGuide`, if it moved along with the keyboard frame.\n\nThis makes it dead simple to vertically center items in a view and have them stay centered when the keyboard appears/disappears.\n\n## Installation\n\n### From CocoaPods\n\nAdd `pod 'JPSKeyboardLayoutGuide'` to your Podfile.\n\n### Manually\n\nDrag the `JPSKeyboardLayoutGuide` folder into your project.\n\n## Usage\n\n`JPSKeyboardLayoutGuide` is a category of `UIViewController`, so for any controller where you want to adopt the behaviour previously described, you must override and call these methods in it's respective callbacks:\n\n```objective-c\n- (void)jps_viewDidLoad;\n- (void)jps_viewWillAppear:(BOOL)animated;\n- (void)jps_viewDidDisappear:(BOOL)animated;\n\n```\n\nA sample implementation would be like this:\n\n```objective-c\n#import \"JPSKeyboardLayoutGuideViewController.h\"\n\n@interface LoginVC : UIViewController\n@end\n\n@implementation LoginVC\n\n- (void)viewDidLoad {\n    [super viewDidLoad];\n    [self jps_viewDidLoad];    \n    [self setupLoginField];\n}\n\n-(void)viewWillAppear:(BOOL)animated {\n    [super viewWillAppear:animated];\n    [self jps_viewWillAppear:animated];\n}\n\n-(void)viewWillDisappear:(BOOL)animated {\n    [super viewWillDisappear:animated];\n    [self jps_viewDidDisappear:animated];\n}\n\n- (void)setupLoginField {\n    self.loginField = [[UITextField alloc] init];\n    self.loginField.translatesAutoresizingMaskIntoConstraints = NO;\n    [self.view addSubview:self.loginField];\n    self.loginField.placeholder = @\"username\";\n    \n    // Constraints\n    NSLayoutConstraint *centerX = [NSLayoutConstraint constraintWithItem:self.loginField\n                                                               attribute:NSLayoutAttributeCenterX\n                                                               relatedBy:NSLayoutRelationEqual\n                                                                  toItem:self.view\n                                                               attribute:NSLayoutAttributeCenterX\n                                                              multiplier:1.0f\n                                                                constant:0.0f];\n    NSLayoutConstraint *bottom = [NSLayoutConstraint constraintWithItem:self.loginField\n                                                              attribute:NSLayoutAttributeBottom\n                                                              relatedBy:NSLayoutRelationEqual\n                                                                 toItem:self.keyboardLayoutGuide\n                                                              attribute:NSLayoutAttributeTop\n                                                             multiplier:1.0f\n                                                               constant:-10.0f];\n    [self.view addConstraints:@[centerX, bottom]];\n}\n\n\n@end\n```\n\nWhen importing `JPSKeyboardLayoutGuide`, you'll see `keyboardLayoutGuide` in addition to `topLayoutGuide` and `bottomLayoutGuide`. All these guides behave in the same way.\n\nFor more details on layout guides, refer to Apple's documentation on the [`UILayoutSupport` Protocol](https://developer.apple.com/library/ios/documentation/uikit/reference/UILayoutSupport_Protocol/Reference/Reference.html)\n\n## License\n\nMIT Licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpsim%2Fjpskeyboardlayoutguide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpsim%2Fjpskeyboardlayoutguide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpsim%2Fjpskeyboardlayoutguide/lists"}