// Judge whether the runtime class is ipad , if yes, return true , otherwise return false
+( BOOL )IsIpad
{
if ([[ UIDevice currentDevice ] userInterfaceIdiom ] == UIUserInterfaceIdiomPad )
{
return TRUE ;
}
return FALSE ;
}
Add the following code before popping
if ([ utils IsIpad ])
{
[alert. popoverPresentationController setSourceView : self . view ];
[alert. popoverPresentationController setSourceRect : CGRectMake ( self . view . bounds . size . width / two , self . view . bounds . size . height / two , one , one )];
}