У меня проблема с клавиатурой, появляющейся в UiscrollView.текстовое поле исчезает, когда клавиатура присутствует для scrollview
я добавил UIScrollView, как
scrlView=[[UIScrollView alloc] initWithFrame:CGRectMake(10, 140, 1000, 600)];
scrlView.scrollEnabled=YES;
scrlView.showsVerticalScrollIndicator=YES;
scrlView.bounces=NO;
к этому Scrollview я добавил 10 строк UITextFields каждой строка имеет 5 TextFields каждой высота TextField является 50px. Если когда-нибудь пытается изменить TextField он перекрывается на keyBoard.For, что я попробовал этот код
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
- (void)keyboardWasShown:(NSNotification*)aNotification
{
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
CGRect bkgndRect = selectetTxtfld.superview.frame;
bkgndRect.size.height += kbSize.height;
[selectetTxtfld.superview setFrame:bkgndRect];
[scrlView setContentOffset:CGPointMake(0.0, selectetTxtfld.frame.origin.y) animated:YES];
}
}
// Вызывается, когда UIKeyboardWillHideNotification отправляется
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
[UIView animateWithDuration:0.4 animations:^{
scrlView.contentInset = contentInsets;
}];
scrlView.scrollIndicatorInsets = contentInsets;
}
Но TextField не появляющийся на клавиатуре.it, появляющийся в позиции scrollview ypoint
помогите мне в решении этой проблемы. Я видел много ответов в StackOverFlow.But не очистил мою проблему
Показаны ошибки при scrlView.contentInset = UIEdgeInsetMake (0,0, kbSize.height, 0); Присвоение 'UIEdgeInsets' (aka 'struct UIEdgeInsets') из несовместимого типа 'int' – sudheer
Показ ошибки в [scrlView setContentOffset: offSetAfterKeyboardIsDisplayed] Отправка 'const CGFloat' (aka 'const float') в параметр несовместимого типа CGPoint (aka 'struct CGPoint') – sudheer
tnks для ответа снова. Это очень важно для меня сейчас – sudheer