Magic Fix for weird UI issues

When you come across some really weird UI issue, you check and check and you're sure your code is absolutely correct, but IT JUST DOESN'T WORK PROPERLY.

Try to execute the UI code after a small delay.

DispatchQueue.main.asyncAfter(deadline: .now() + 0.25, execute: {
    // UI CODE
})

Or Objective-C version:

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
    // UI CODE
});

Why? Because you're playing with a buggy system and that's the art of iOS programming.