When [textField becomeFirstResponder]
is called cell is covered by the keyboard, I want when cell location above the keyboard when [textField becomeFirstResponder]
is called. How can I do this?
Similar to the iphone SMS function!
When [textField becomeFirstResponder]
is called cell is covered by the keyboard, I want when cell location above the keyboard when [textField becomeFirstResponder]
is called. How can I do this?
Similar to the iphone SMS function!
You can use following code to show your textfield which in bottom of tableview by changing tableview "Y" coordinate
#pragma mark - textfield delegate
- (void) textFieldDidBeginEditing:(UITextField *)sender {
activeTextField = sender;
if ([sender isEqual:TextField1]) {
[self setViewMovedForViewIndex:1];
}
else if ([sender isEqual:TextView2])
{
[self setViewMovedForViewIndex:2];
}
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
[self setViewMovedForViewIndex:0];
return YES;
}
- (void)setViewMovedForViewIndex:(int)index {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5]; // if you want to slide up the view
CGRect rect = self.table.frame;
switch (index) {
case 0:
rect.origin.y = 0;
break;
case 1:
rect.origin.y = 0;
break;
case 2:
rect.origin.y = -160;
break;
default:
break;
}
self.table.frame = rect;
[UIView commitAnimations];
}
Seems like you are looking for KeyboardAccessory
view. You can achieve this. Look at this tutorial. It will help. And try to study about it.
Apple has a sample for this.