Receiver type for instance消息未声明带有selector的方法

时间:2013-05-15 13:34:42

标签: objective-c

我只是新手,并且不确定我是否必须定义旋转,如果我只是犯了错误或者只是做错了一般。

这是我到目前为止所拥有的:

- (IBAction)TestDrive:(id)sender {                    
    CGPoint center = CGPointMake(car.center.x,
    self.view.frame.origin.y + car.frame.size.height/2);
    [UIView animateWithDuration:3 animations:^{
        car.center = center;
    } 
     completion:^(BOOL finished){
    [self rotate]; //error here
    }];
}

- (void)rotate;{
    }

- (void)returnCar; {
    }

- (void)continueRotation;{
    }

@end

1 个答案:

答案 0 :(得分:0)

除非您使用最新的LLVM编译器(并且可能打开特定选项),否则编译器会在调用该方法时发出警告是否尚未看到方法的声明。由于编译器在编译时执行一次扫描,因此在调用站点出现问题后实现这些方法。

移动实现或将其添加到YourClass.m的顶部:

@interface YourClass()
- (void)rotate;
- (void)returnCar;
- (void)continueRotation;
@end