PopoverPresentationController

PopoverPresentationController

我有一个弹出窗口出现在按钮点击,但它没有动画。我希望它从零开始,并成长为正确的大小,类似于facebook胡萝卜行动对一个职位。任何帮助都非常感谢。代码如下:

@IBAction func button(sender: AnyObject) {
    let popover = PopoverController()
    popover.modalPresentationStyle = .Popover
    popover.preferredContentSize = CGSizeMake(UIScreen.mainScreen().bounds.width, 100)

    let popoverPresentationController = popover.popoverPresentationController
    popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Up
    popoverPresentationController?.delegate = self
    popoverPresentationController?.sourceView = sender as UIView
    popoverPresentationController?.sourceRect = sender.bounds

    self.presentViewController(popover, animated: true, completion: nil)
}


func adaptivePresentationStyleForPresentationController(controller: UIPresentationController!) -> UIModalPresentationStyle {
        return UIModalPresentationStyle.None
}

最佳答案

你可以试试

popoverPresentationController?.modalTransitionStyle = .crossDissolve

就在演讲之前。

关于ios - 如何为iPhone,iOS 8上的弹出框设置动画,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29156060/

10-09 18:31