My class is a CALayer
subclass, and I have added a observer through NSNotificationCenter
, when catching the message, it will run function like this:
- (void)setCurrentAutoValue:(NSNotification *) obj
{
[self setNeedsDiaplay];
}
but this does not work, can anyone help?
Apparently, it is necessary to call setNeedsDisplay on the main thread. You can do this by using the performSelectorOnMainThread
method. For example in your case:
[self performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:0 waitUntilDone:NO];