2012-06-21 18 views
0

我想從SecondViewController.m的名爲ScanAnimation.m的文件中調用名爲animateRight的函數。在UIView類中調用一個函數?使用Xcode上的Obj C

在SecondViewController.m頂我:

ScanAnimation * Animation = [[ScanAnimation alloc] init]; 

和我打這個電話有:

[Animation animateRight]; 

,我得到的錯誤:

'ScanAnimation' 未申報

我在做什麼錯了?

回答

1

您需要的ScanAnimation頭文件導入到你正在在調用文件

所以在SecondViewController.m你會#import "SecondViewController.h"

+0

確定現在我得到下在頂部加入#import "ScanAnimation.h"「。 - animateRight'not found ... – Sciguy77

+0

好吧,您需要在ScanAnimation類的頭文件中聲明它。你所做的就是複製 - (void)animateRight部分並將其放入頭文件中。 - (無效)animateRight; –