
Your application has presented a
UIAlertController(<UIAlertController: 0x7f9ec624af70>) of styleUIAlertControllerStyleActionSheet. ThemodalPresentationStyleof aUIAlertControllerwith this style isUIModalPresentationPopover. You must provIDe location information for this popover through the alert controller’spopoverPresentationController. You must provIDe either asourceVIEwandsourceRector abarbuttonItem. If this information is not kNown when you present the alert controller,you may provIDe it in theUIPopoverPresentationControllerDelegatemethod-prepareForPopoverPresentation.
这在iPhone上工作得很好:
let optionMenu = UIAlertController(Title: nil,message: nil,preferredStyle: .ActionSheet)let reminderAction = UIAlertAction(Title: "Reminder",style: .Default,handler: { (alert: UIAlertAction!) -> VoID in }optionMenu.addAction(reminderAction)self.presentVIEwController(optionMenu,animated: true,completion: nil) 我遇到了一些类似的问题,解决方法是:
let optionMenu = UIAlertController(Title: nil,preferredStyle: .ActionSheet)optionMenu.popoverPresentationController?.sourceVIEw = self.vIEwoptionMenu.popoverPresentationController?.sourceRect = self.vIEw.bounds
但它并没有对我有用,可能是因为我的ActionSheet的发件人在UItablevIEwCell上.
我厌倦了将AlertController的SourcevIEw设置为tableVIEw的Cell,但它没有正确放置,有时它部分可见这是我试过的:
optionMenu.popoverPresentationController?.sourceVIEw = currentCell.contentVIEwoptionMenu.popoverPresentationController?.sourceRect = currentCell.contentVIEw.bounds
任何线索如何解决这个问题?
解决方法 下面给出的示例代码适用于iPhone和iPad.guard let vIEwRect = sender as? UIVIEw else { return } let cameraSettingsAlert = UIAlertController(Title: NSLocalizedString("Please choose a course",comment: ""),message: NSLocalizedString("",preferredStyle: .ActionSheet) cameraSettingsAlert.modalPresentationStyle = .Popover let photoResolutionAction = UIAlertAction(Title: NSLocalizedString("Photo Resolution",style: .Default) { action in } let cameraOrIEntationAction = UIAlertAction(Title: NSLocalizedString("Camera OrIEntation",style: .Default) { action in } let flashModeAction = UIAlertAction(Title: NSLocalizedString("Flash Mode",style: .Default) { action in } let timeStampOnPhotoAction = UIAlertAction(Title: NSLocalizedString("Time Stamp on Photo",style: .Default) { action in } let cancel = UIAlertAction(Title: NSLocalizedString("Cancel",style: .Cancel) { action in } cameraSettingsAlert.addAction(cancel) cameraSettingsAlert.addAction(cameraOrIEntationAction) cameraSettingsAlert.addAction(flashModeAction) cameraSettingsAlert.addAction(timeStampOnPhotoAction) cameraSettingsAlert.addAction(photoResolutionAction) if let presenter = cameraSettingsAlert.popoverPresentationController { presenter.sourceVIEw = vIEwRect; presenter.sourceRect = vIEwRect.bounds; } presentVIEwController(cameraSettingsAlert,completion: nil) 总结 以上是内存溢出为你收集整理的ios – 如何在iPad中显示动作表全部内容,希望文章能够帮你解决ios – 如何在iPad中显示动作表所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)