Nookaraju
Nookaraju

Reputation: 1668

Actionsheet popover background truns to black before popover gets dismissed in ios 9

Using following:

  [self.actionSheetPostOptions showFromBarButtonItem:self.navigationItem.rightBarButtonItem animated:YES];

also tried

UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
                                                                       message:nil
                                                                preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *actnCamera = [UIAlertAction actionWithTitle:@"Camera" style:UIAlertActionStyleDefault
                                                    handler:^(UIAlertAction * action) {
                                                 }];

UIAlertAction *actnLibrary = [UIAlertAction actionWithTitle:@"Library" style:UIAlertActionStyleDefault
                                                 handler:^(UIAlertAction * action) {
                                                 }];

[alertController addAction:actnLibrary];
[alertController addAction:actnCamera];
[alertController setModalPresentationStyle:UIModalPresentationPopover];
UIPopoverPresentationController *popPresenter = [alertController
                                                             popoverPresentationController];
popPresenter.barButtonItem = self.navigationItem.rightBarButtonItem;
[self presentViewController:alertController animated:YES completion:nil];

but still getting same issue while dismissing.

Update iOS 11: This issue no longer exists in iOS 11.

Upvotes: 13

Views: 689

Answers (2)

Nookaraju
Nookaraju

Reputation: 1668

I have added workaround for this by disabling view animations on actionsheet presentation and enabling back after dismissal of sheet.

Use below to disable view animations before presentation of UIAlertController.

 [UIView setAnimationsEnabled:NO]; 

and enable view animations after dismissal of UIAlertController.

 [UIView setAnimationsEnabled:YES];

Sure, its not a solution but it may help.

Upvotes: 0

Frederik Winkelsdorf
Frederik Winkelsdorf

Reputation: 4573

Have you tried this on real Device, too? I saw the same behavior when running in iOS Simulator but on the Device it works fine.

Upvotes: 3

Related Questions