2014-11-25 44 views
4

我有和問題與UIInterpolatingMotionEffect類,應用程序編譯,但是當我試圖存檔我得到這個編譯錯誤:爲「UIInterpolatingMotionEffect」不可見@interface聲明選擇「initWithKeyPath:類型:」

No visible @interface for 'UIInterpolatingMotionEffect' declares the selector 'initWithKeyPath:type:'

我得到這個錯誤對UIInterpolatingMotionEffect這個功能initialisers:

- (void)addMotionEffects 
{ 
    UIInterpolatingMotionEffect *horizontalMotionEffect = [[UIInterpolatingMotionEffect alloc] 
                  initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; 

    horizontalMotionEffect.minimumRelativeValue = @(-20); 
    horizontalMotionEffect.maximumRelativeValue = @(20); 

    UIInterpolatingMotionEffect *verticalMotionEffect = [[UIInterpolatingMotionEffect alloc] 
                 initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; 
    verticalMotionEffect.minimumRelativeValue = @(-20); 
    verticalMotionEffect.maximumRelativeValue = @(20); 

    UIMotionEffectGroup *group = [UIMotionEffectGroup new]; 
    group.motionEffects = @[horizontalMotionEffect, verticalMotionEffect]; 
    [self.containerView addMotionEffect:group]; 
} 

我認爲這是一種錯誤的嘗試編譯arm64架構的時候,但我無法弄清楚如何解決問題。

任何想法?

+0

你是否建設以支持iOS 6以及,偶然? – 2014-11-25 10:43:29

+0

Nop,部署目標是iOS7和基礎SDK iOS8.1 – jberlana 2014-11-25 10:45:47

+0

可能這個鏈接會幫助你.. http://www.teehanlax.com/blog/introduction-to-uimotioneffect/ – iMash 2014-11-25 12:34:31

回答

1

這是跆拳道的答案,以及它是一個跆拳道的問題,但工程...

爲了避免我創建了一個類別中的編譯錯誤UIInterpolatingMotionEffect與給錯誤的選擇。但仍然不知道爲什麼Xcode不存檔沒有這個...

@interface UIInterpolatingMotionEffect (lol) 
- (instancetype)initWithKeyPath:(NSString *)keyPath type:(UIInterpolatingMotionEffectType)type; 
@end 
相關問題