UIAlertController is Crashed (iPad)

后端 未结 10 1769
长情又很酷
长情又很酷 2020-12-13 17:58

I am using Xcode 6 to develop an iOS Application.

When I used UIAlertController, it can be worked well on iPhone 6 simulator, but crashes on iPad simula

10条回答
  •  旧时难觅i
    2020-12-13 18:51

    I use this code, very easy and understand, maybe i can help for any

    //if iPhone
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
            [self presentViewController:actionSheet animated:YES completion:nil];
        }
        //if iPad
        else {
            // Change Rect to position Popover
            UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:actionSheet];
            [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        }
    

提交回复
热议问题