Calling Instance Method from the Objective C Selector
Is it possible to call the instance method of an object from the selector? Is the below possible? It gives me compilation error that ":" is missing or something:
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(([self.person dance]))
开发者_运维百科 userInfo:nil
repeats:YES];
Change target to self.person and use the dance selector:
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self.person
selector:@selector(dance)
userInfo:nil
repeats:YES];
Have you tried changing the target? Like this:
timer = [NSTimer scheduledTimerWithTimeInterval:1.0
target:self.person
selector:@selector(dance)
userInfo:nil
repeats:YES];
精彩评论