wimagguc / ios-custom-alertview

Custom UIAlertView. Continue adding images and UIViews to dialogs in iOS7+
Other
1.66k stars 394 forks source link

Lunch Alert in viewDidLoad Method of viewController #26

Closed WillBatz closed 10 years ago

WillBatz commented 10 years ago

I tried to show the CostumAlert when you start the application but this does not appear. in method viewDidLoad of delegate could help than

wimagguc commented 10 years ago

We attach the enclosing UIView to the app's first window, which might not be ready yet in the moment you called the function. Launching it a split second later is a good trick; try to add the code in the following block (also works in the viewDidLoad method):

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    // Open the dialog here
});