Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
438 views
in Technique[技术] by (71.8m points)

iphone - 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).

However, when I try to call [UIView beginAnimations:@"textFieldSlide", nil] the compiler warns me that:

Line Location RootViewController.m:41: warning: 'UIView' may not respond to '+beginAnimations::'

The autocomplete in Xcode also fails to see that method, as well as commitAnimations.

Am I missing an import to get these methods?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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];

instead.

If Xcode's autocompletion fails, most of the time it is that you've forgot a ] or a ; somewhere.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...