弹出窗口出现时方向箭头错误

Wrong direction arrow when popup shows up

我正在使用此功能显示相机胶卷中 select 图片的弹出视图:

func selectImage(sender: UICollectionViewCell){
    if UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum)
    {
        let imagePickerController = UIImagePickerController()
        imagePickerController.delegate = self
        imagePickerController.sourceType = UIImagePickerControllerSourceType.SavedPhotosAlbum
        imagePickerController.allowsEditing = false

            self.popOver = UIPopoverController(contentViewController: imagePickerController)
            self.popOver?.presentPopoverFromRect(sender.frame, inView: self.view, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)

    }
}

在上面的代码中,sender.frame 指的是带有图像图标(第一个)的 CollectionViewCell,但是如您所见,弹出视图的箭头位于顶部。

我试过 UIPopoverArrowDirection.Down 但输出是有线的:

我就是这样称呼 selectImage():

func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
//conditions to know if the first cell is selected
   selectImage(collectionView.cellForItemAtIndexPath(indexPath)!)
}

呈现 ANY 弹出窗口的更通用的方式如以下代码片段所示:

self.popOver?.presentPopoverFromRect(sender.frame, inView: sender.superview, permittedArrowDirections: UIPopoverArrowDirection.Any, animated: true)