Answer the question
In order to leave comments, you need to log in
How to update View when receiving notification from NSNotificationCenter?
The application has a view controller that is subscribed to notifications. When a certain notification is received, the method changes the text of the text field.
There is a suspicion that a lot of time passes between receiving a notification and directly updating the text.
How to force the view controller to update its view immediately after receiving a notification?
Answer the question
In order to leave comments, you need to log in
Doctor, are you sure you are accessing the UI from the main thread and not from a secondary thread? If not, fix it and see if it solves your problem.
It was noticed about flows correctly, try
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"myNotificationName" object:nil];
});
notification center thing in principle is not fast. Use a delegate whenever possible. When working with NC, make sure that you not only subscribe to notifications, but also unsubscribe from them in time - the same controller can subscribe to the same notification many times, so the handler will be called many times
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question