https://github.com/markrickert/uiview-formscroll
UIView category that scrolls a view up or down. Useful for moving a view when you show a keyboard so that the view isn't covered up.
https://github.com/markrickert/uiview-formscroll
Last synced: 9 months ago
JSON representation
UIView category that scrolls a view up or down. Useful for moving a view when you show a keyboard so that the view isn't covered up.
- Host: GitHub
- URL: https://github.com/markrickert/uiview-formscroll
- Owner: markrickert
- Created: 2011-11-06T15:35:55.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2011-11-21T20:22:39.000Z (over 14 years ago)
- Last Synced: 2025-01-13T01:11:40.449Z (over 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 87.9 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
#How to use
1. Add the `.h` and `.m` files to your project.
2. Import the `.h` file using: `#import "UIView+FormScroll.h"`
3. Example usage for moving a view up and down when a text field becomes active and resigns the first responder:
```Objective-C
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[self.view scrollToView:textField];
}
-(void) textFieldDidEndEditing:(UITextField *)textField
{
[self.view scrollToY:0];
[textField resignFirstResponder];
}
```
#Credits
Originally posted to [StackOverflow.com](http://stackoverflow.com/questions/5220818/moving-uiview-up-when-keyboard-shown/5221243#5221243) by [Dan Ray](http://www.danray.net).
Improvements by [Mark Rickert](http://www.mohawkapps.com)
#License
Public Domain