我正在使用UITableView
,并在其中添加了UITextView
。
我想将UITableView
位移到键盘上方。
以下是我的代码:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{
NSCharacterSet *doneButtonCharacterSet = [NSCharacterSet newlineCharacterSet];
NSRange replacementTextRange = [text rangeOfCharacterFromSet:doneButtonCharacterSet];
NSUInteger location = replacementTextRange.location;
if (textView.text.length + text.length > 250){
if (location != NSNotFound){
//self.view.frame= CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+100, self.view.frame.size.width, self.view.frame.size.height);
[textView resignFirstResponder];
}
return NO;
}
else if (location != NSNotFound){
//self.view.frame= CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+100, self.myTable.frame.size.width, self.myTable.frame.size.height);
[textView resignFirstResponder];
return NO;
}
return YES;
}