[英]Calling a function in UIView class? With Obj C on Xcode
I'm trying to call a function called animateRight in a file called ScanAnimation.m from SecondViewController.m. 我试图在SecondViewController.m中名为ScanAnimation.m的文件中调用名为animateRight的函数。
In the top of SecondViewController.m I have: 在SecondViewController.m的顶部,我有:
ScanAnimation * Animation = [[ScanAnimation alloc] init];
and I make the call with: 我打了电话:
[Animation animateRight];
and I get the error: 我得到错误:
'ScanAnimation' undeclared 未声明“ ScanAnimation”
What am I doing wrong? 我究竟做错了什么?
You need to import the ScanAnimation header file into the file you are making the call in. 您需要将ScanAnimation头文件导入正在进行调用的文件中。
So in the SecondViewController.m you would add #import "ScanAnimation.h"
at the top under #import "SecondViewController.h"
所以在SecondViewController.m将添加
#import "ScanAnimation.h"
下,在顶部#import "SecondViewController.h"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.