获得语义问题&解析问题:缺少方法声明的上下文&用于暂停和恢复UIImageviewanimation方法的预期方法体。在MainViewController.h文件中声明了这两个方法
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
- (void)resumeLayer:(CALayer *)layer;
- (void)PauseLayer:(CALayer *)layer;
@interface MainViewController : UIViewController
@property (nonatomic, retain) UIToolbar *toolbar;
@property (strong)AVAudioPlayer *audioPlayer;
@property (nonatomic, retain) NSTimer * timer;
m文件中的方法
-(void)pauseLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
layer.speed = 0.0;
layer.timeOffset = pausedTime;
}
-(void)resumeLayer:(CALayer*)layer
{
CFTimeInterval pausedTime = [layer timeOffset];
layer.speed = 1.0;
layer.timeOffset = 0.0;
layer.beginTime = 0.0;
CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
layer.beginTime = timeSincePause;
}
我很困惑我在这里没有定义的内容。
感谢您的帮助。
答案 0 :(得分:3)
您应该将方法定义放在@interface和@end块
中@interface MainViewController : UIViewController
@property (nonatomic, retain) UIToolbar *toolbar;
@property (strong)AVAudioPlayer *audioPlayer;
@property (nonatomic, retain) NSTimer * timer;
- (void)resumeLayer:(CALayer *)layer;
- (void)PauseLayer:(CALayer *)layer;
@end