6/13/2009

NSSelectorFromString

I can pass in some strings as a parameter and then have it perform the selector method in the passed in method.

メソッドの名前をNSStringのパラメーターでうけとってそれを後でselectorとして扱う方法を発見。


- (void)performThis:(NSString *)aString {
SEL aSelector = NSSelectorFromString(aString);
[self performSelector:aSelector withObject:nil afterDelay:2];
}

No comments:

Post a Comment