Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...