我在iOS Swift上使用了popoverPresentationController,並且我已經在popover中放置了圖像和文本?如何修改或更改PopoverPresentationController的大小?
我遇到的問題是內容對popover來說太大了?是否可以設置尺寸?
圖片低於我的問題和試用代碼和錯誤消息?
let myAlert = UIAlertController(title: "\n\n\n\n\n\n", message: "Correct answer selected, move on to next level", preferredStyle: UIAlertControllerStyle.actionSheet)
let okAction = UIAlertAction(title: "Ok", style: UIAlertActionStyle.default)
{
// action in self.dismiss(animated: true, completion: nil)
action in self.performSegue(withIdentifier: "goSegue1", sender: self)
self.musicEffect.stop()
}
// put image into action sheet
let imageView = UIImageView(frame: CGRect(x: 70, y: -30, width: 140, height: 140))
imageView.image = #imageLiteral(resourceName: "wellDone2.png")
myAlert.addAction(okAction);
myAlert.view.addSubview(imageView)
// display the alert messgae
myAlert.popoverPresentationController?.sourceView = view
myAlert.popoverPresentationController?.sourceRect = (sender as AnyObject).frame
myAlert.preferredContentSize = CGSize(width: 500, height: 800)
請編輯您的問題,並將您的實際代碼複製並粘貼到問題中。不要發佈代碼圖片。 – rmaddy