为什么不给UIView的回应beginAnimations? [英] Why wouldn't UIView respond to beginAnimations?
问题描述
我试图动画添加一个新的子视图到表格视图。 (当用户点击表视图上方的导航栏上的加号按钮,我想有一个文本字段和一个按钮一个子视图,从导航栏下向下滑动)。
I'm trying to animate adding a new subview to a table view. (When the user clicks on the Plus sign button on the nav bar above the table view, I want a subview with a text field and a button to slide down from under the nav bar).
然而,当我尝试调用 [UIView的beginAnimations:@textFieldSlide零]
编译器警告我说:
However, when I try to call [UIView beginAnimations:@"textFieldSlide", nil]
the compiler warns me that:
线位置RootViewController.m:41:
警告:'的UIView'可能不响应
'+ beginAnimations ::
Line Location RootViewController.m:41: warning: 'UIView' may not respond to '+beginAnimations::'
在X code中的自动完成还没有看到,方法,以及 commitAnimations
。
The autocomplete in Xcode also fails to see that method, as well as commitAnimations
.
我缺少一个导入得到这些方法呢?
Am I missing an import to get these methods?
推荐答案
有没有需要进口QuartzCore,UIKit的是它提供了
There's no need to import QuartzCore, UIKit is providing it.
您使用了错误的方法签名。您应该使用
You're using the wrong method signature. You should use
[UIView beginAnimations:@"textFieldSlide" context:nil];
代替。
如果X code'S自动完成失败,大部分时间是你已经忘了]
或;
的某个地方。
If Xcode's autocompletion fails, most of the time it is that you've forgot a ]
or a ;
somewhere.
这篇关于为什么不给UIView的回应beginAnimations?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!