2

获取语​​义问题和解析问题:缺少方法声明的上下文和用于暂停和恢复 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;
 }

我对我在这里没有定义的东西感到困惑。

感谢帮助。

4

1 回答 1

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
于 2012-06-19T20:34:48.553 回答