Objective C - Calling a class method on the main thread?

后端 未结 2 1112
旧时难觅i
旧时难觅i 2021-02-15 17:50

How can I call a CLASS METHOD on the main thread? Something like:

[SomeClass performSelectorOnMainThread:staticMethod withObject:nil];
2条回答
  •  野性不改
    2021-02-15 18:45

    How about:

    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:[SomeClass class] selector:@selector(SomeClass) object:nil];
    [[NSOperationQueue mainQueue] addOperation:operation];
    

提交回复
热议问题