Objective c UITextField委托方法中的动画不执行
单击文本框txtAge时,会调用委托方法,但不会执行动画:Objective c UITextField委托方法中的动画不执行,objective-c,iphone,Objective C,Iphone,单击文本框txtAge时,会调用委托方法,但不会执行动画: -(void)textFieldDidBeginEditing:(UITextField *)textField { NSLog(@"field Edited"); if (textField.tag == 0) { NSLog(@"IF Block "); [UIPickerView beginAnimations:nil context:nil]; [UIPicke
-(void)textFieldDidBeginEditing:(UITextField *)textField {
NSLog(@"field Edited");
if (textField.tag == 0) {
NSLog(@"IF Block ");
[UIPickerView beginAnimations:nil context:nil];
[UIPickerView setAnimationDuration:0.3];
PkrView .frame = CGRectMake(0, 450, 414, 215);
}
else
{
NSLog(@" else");
}
return; }
你能找出原因吗?你错过了委托电话。然而,引用苹果关于beginAnimations的文档:
iOS 4.0及更高版本不鼓励使用此方法。您应该使用基于块的动画方法来指定动画
应按照以下方式转换动画:
[UIPickerView animateWithDuration:0.3 animations:^{
self.view.frame = CGRectMake(0, 450, 414, 215);
} completion:^(BOOL finished){
// optional, do something after animation completed
}];
欢迎来到Facebook,对于非xcode IDE相关的问题不要使用xcode标签。你能把你的问题改一下吗?你肯定错过了很多东西。花点时间看看。