I want to show a view, which contain a UITextField, and I would show automatically the keyboard with the message becomeFirstResponder. With iOS 7, there isn't any problem. But since iOS8, it doesn't work. I'm configuring the view like this :
- (void)showViewAddScore{
if(!self.viewPopOver){
//a l'initialisation de la vue, on design le contour
self.viewPopOver = [self.view viewWithTag:100];
self.viewPopOver.layer.cornerRadius = 8;
self.viewPopOver.layer.masksToBounds = YES;
self.viewPopOver.layer.borderWidth = 1;
self.viewPopOver.layer.borderColor = [[UIColor colorWithRed:8.0/255 green:65.0/255 blue:32.0/255 alpha:1] CGColor];
}
//deplacement de la vue
CGPoint point;
point.x = self.viewPopOver.frame.origin.x;
point.y = 300;
[self manageViewPopOver:self.viewPopOver withCGPoint:point];
[self.textfieldAddScore becomeFirstResponder];
}
And the method to show the view with animation:
- (void)manageViewPopOver:(UIView *)view withCGPoint:(CGPoint)point {
[UIView animateWithDuration:0.3
delay:0.1
options:UIViewAnimationOptionCurveLinear
animations:^{
CGRect frame = view.frame;
frame.origin.y = point.y;
frame.origin.x = point.x;
view.frame = frame;
}
completion:nil];
}
The problem is :
When I call the method showViewAddScore
for the first time, the keyboard is showing but not the view. When I call the method a second time, the view is showing.
And when I delete the line [self.textfieldAddScore becomeFirstResponder];
, the view is showing when I call the method for the first time. SO, there is a problem with the [self.textfieldAddScore becomeFirstResponder];
and animation.
I've tried move the line after the animation, but the problem persist.
Thank you for your help.