I used the UIAlertController to display the popup.
On the iPhone, the pop-up is well visible and the surrounding color is dark.
However, the iPad has an error.
let alertVC = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
if UIDevice.current.userInterfaceIdiom == .pad
{
alertVC.popoverPresentationController?.sourceView = self
alertVC.popoverPresentationController?.sourceRect = CGRect(x: UIScreen.main.bounds.midX, y: UIScreen.main.bounds.maxY, width: 0, height: 0)
alertVC.popoverPresentationController?.permittedArrowDirections = []
}
// add alertVC.addAction()
DispatchQueue.main.async
{
guard let parentVC = self.parentViewController as? MoreViewController else { return }
parentVC.present(alertVC, animated: true, completion: nil)
}
I solved the error that occurred in the iPad through search.
However, when the Alert is displayed on the iPad, the surroundings do not become dark.
Please help me.