重写MPMoviePlayerController.currentPlaybackTime时如何摆脱警告?

时间:2010-12-29 22:43:12

标签: iphone iphone-sdk-3.0 ios4

我试图覆盖MPMoviePlayerController类的currentPlaybackTime属性。我在我的MPMoviePlayerController子类的头文件中声明了以下内容。

@interface MyMoviePlayerController : MPMoviePlayerController {
}

@property(nonatomic, getter=getCurrentPlaybackTime, setter=setCurrentPlaybackTime) 

- (NSTimeInterval) getCurrentPlaybackTime;
- (void) setCurrentPlaybackTime:(NSTimeInterval)newValue;

@end

我收到两条警告信息,如下所示:

warning: property 'currentPlaybackTime' 'setter' attribute does not match super class 'MPMoviePlayerController' property

warning: property 'currentPlaybackTime' 'getter' attribute does not match super class 'MPMoviePlayerController' property

覆盖实际上有效但有没有办法抑制恼人的警告?

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以尝试删除自己的getter / setter并使用默认的

@property(nonatomic) NSTimeInterval currentPlaybackTime;

并使用

- (NSTimeInterval) currentPlaybackTime;

而不是

- (NSTimeInterval) getCurrentPlaybackTime;

这是默认的getter和setter,你不必设置自己的。