I have one UIView. Inside that I have two text fields - username
and password
, and one submit
UIButton. I kept my UIView at centre of screen. So now when I edit my username and password field
, my password field is getting hide by keyboard.
So is it possible to show my "total UIView with that two text fields" up, when my keyboard is on?
Please help on some code.Thanks!
updated code:
@implementation ViewController
@synthesize scrollView;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)textFieldDidBeginEditing:(UITextField *)textField {
self.scrollView.contentSize = CGSizeMake(self.scrollView.contentSize.width, (self.scrollView.contentSize.height + 260));
self.scrollView.contentOffset = CGPointMake(0,120);
}
-(void)textFieldDidEndEditing:(UITextField *)textField {
self.scrollView.contentOffset = CGPointZero;
self.scrollView.contentSize = CGSizeMake([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
}