zhu86804396 2015-07-21 03:01 采纳率: 25%
浏览 2078

Object c 错误unrecognized selector sent to instance

本人ios编程小白一个,正在学,跟着视频打代码,运行出了这么个错,找了半天也没看出来,各位大大帮忙看下,代码就是tom猫的一个小程序
错误日志
unrecognized selector sent to instance 0x7fbd20627180
2015-07-21 10:52:58.264 Tom[8325:418012] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController drink:]: unrecognized selector sent to instance 0x7fbd20627180'

代码

 #import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *tom;

@end

@implementation ViewController

-(void)tomAnimation:(NSString *)img count:(int)count
{
    if([self.tom isAnimating]) return;
    NSMutableArray *arrayM = [NSMutableArray array];
    for (int i = 0; i < count; i++) {
        NSString *imageName = [NSString stringWithFormat:@"%@_%02d.jpg",img,i];
//        UIImage *image = [UIImage imageNamed:imageName];
        NSString *path = [[NSBundle mainBundle] pathForResource:imageName ofType:nil];
        UIImage *image = [UIImage imageNamed:path];
        NSLog(@"image is %@ and id is %02d",image,i);
        [arrayM addObject:image];
    }
    [self.tom setAnimationImages:arrayM];

    [self.tom setAnimationDuration:arrayM.count * 0.1];
    [self.tom setAnimationRepeatCount:1];
    //2.开始动画
    [self.tom startAnimating];
    //动画完成之后,再清除动画数组内容


    [self performSelector:@selector(clearTom) withObject:nil afterDelay:self.tom.animationDuration];

}

-(void)clearTom
{
    self.tom.animationImages = nil;
}

- (IBAction)drink
{
    //序列帧动画,所谓序列帧动画,就是让一组图片一张一张的顺序播放
    //1.图片的数组
    [self tomAnimation:@"drink" count:81];
}


@end

  • 写回答

2条回答

  • 谷_寒 2015-08-04 09:44
    关注

    方法和类(对象)之间没有对应,也就是对象的类中没有这个方法

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog