ich mehrere UITextField
in einem Scrollview haben, und ich Textfelder Grenze Brauch vonUITextField Grenze Flashs
layer.borderColor = ...,
layer.borderRadius = 3.0,
layer.borderWidth = 0.1,
layer.masksToBounds = YES.
- (void)keyboardWillShow:(NSNotification *)notification {
CGFloat animDuration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
CGRect rect = [self.currentTextField superview].frame;
[UIView animateWithDuration:animDuration animations:^{
[self.scrollView scrollRectToVisible:rect animated:NO];
}];
}
- (void)keyboardWillHide:(NSNotification *)notification {
CGFloat animDuration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] floatValue];
CGRect rect = [self.currentTextField superview].frame;
[UIView animateWithDuration:animDuration animations:^{
[self.scrollView scrollRectToVisible:rect animated:NO];
}];
}
Bug jedes Mal wenn ich konzentriert jede Textfield bekam Einstellung oder die Tastatur entlassen, die alle die Grenze blinkt das Textfeld. Aber wenn ich nur die scrollView scrollte keine blinkt
warum Sie verwenden müssen '[UIView animateWithDuration: animDuration Animationen:^{ [se lf.scrollView scrollRectToVisible: rect animiert: NEIN]; }]; ', warum nicht verwenden' [self.scrollView scrollRectToVisible: rect animiert: NEIN]; 'direkt – childrenOurFuture
@childrenOurFuture ist richtig, versuchen, ohne UiView Animation zu scrollen, aber mit animierten: YES – DoN1cK
First Wenn die Tastatur ein- oder ausblenden Ich brauche den scrollView entsprechend mit der Tastaturanimationsdauer zu scrollen. –