Dismissing UIAlertViews when entering background state

My call would be to add a category to UIAlertview adding the following function : – (void) hide { [self dismissWithClickedButtonIndex:0 animated:YES]; } And to suscribe to UIApplicationWillResignActiveNotification : [[NSNotificationCenter defaultCenter] addObserver:alertView selector:@selector(hide) name:@”UIApplicationWillResignActiveNotification” object:nil];

Presenting a view controller modally from an action sheet’s delegate in iOS8 – iOS11

Update: As of iOS 9 SDK, UIActionSheet is deprecated, so do not expect a fix regarding this issue. It is best to start using UIAlertController when possible. The problem seems to come from Apple’s switch to using UIAlertController internally to implement the functionality of alert views and action sheets. The issue is seen mostly on … Read more

How to change the background color of the UIAlertController?

You have to step some views deeper: let subview = actionController.view.subviews.first! as UIView let alertContentView = subview.subviews.first! as UIView alertContentView.backgroundColor = UIColor.blackColor() And maybe you want to keep original corner radius: alertContentView.layer.cornerRadius = 5; Sorry for the “Swifting” but i’m not familiar with Objective-C. I hope that’s similar. Of course it’s also important to change … Read more

ActionSheet not working iPad

You need to provide a source view or button just before presenting optionMenu since on iPad its a UIPopoverPresentationController, As it says in your error. This just means that your action sheet points to the button letting the user know where it started from. For example if you’re presenting your optionMenu by tapping on the … Read more

Change Text Color of Items in UIActionSheet – iOS 8

There’s an easy way if you still want to use UIActionSheet instead of UIAlertController in order to support older iOS versions. UIActionSheet actually uses UIAlertController in iOS 8, and it has a private property _alertController. SEL selector = NSSelectorFromString(@”_alertController”); if ([actionSheet respondsToSelector:selector]) { UIAlertController *alertController = [actionSheet valueForKey:@”_alertController”]; if ([alertController isKindOfClass:[UIAlertController class]]) { alertController.view.tintColor = … Read more