在下面这段摘录代码中:
/*A ClassName with instanceMethod and ClassMethod */
-(void)instanceMethod;
+(void)ClassMethod;
/*To call a instance method in background */
ClassName class1obj = [ClassName alloc] init];
[class1obj performSelectorInBackground:@selector(instanceMethod) withObject:nil];
怎么用performSelectorInBackground
在背景中调用ClassMethod?
类本身就是对象,所以只要调用:
[ClassName performSelectorInBackground:@selector(ClassMethod) withObject:nil];
应该就可以
试试这个;
[ClassName performSelectorInBackground:@selector(methodTobeCalled) withObject:nil];
用self代替类的名字也可以:
试试
[self performSelectorInBackground:@selector(methodTobeCalled) withObject:nil];