ios – Swift Unbalanced调用开始/结束外观转换

前端之家收集整理的这篇文章主要介绍了ios – Swift Unbalanced调用开始/结束外观转换前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这一直困扰我一段时间.我在UITabBarController中有一个UISplitViewController.主视图是TableView.当我单击一个单元格时,我会调出一个非常基本的视图控制器,只有一个UIButton居中.以下是视图控制器的代码
class TestViewController: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate {
    @IBOutlet weak var button: UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    @IBAction func buttonPressed(sender: AnyObject) {
        let pickerC = UIImagePickerController()
        pickerC.delegate = self

        pickerC.modalPresentationStyle = .Popover
        pickerC.popoverPresentationController?.sourceView = button as UIView
        pickerC.popoverPresentationController?.sourceRect = (button as UIView).bounds
        pickerC.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection.Any
        self.presentViewController(pickerC,animated: true,completion: nil)//4
    }

    func imagePickerController(picker: UIImagePickerController,didFinishPickingImage image: UIImage!,editingInfo: [NSObject : AnyObject]!) {
        self.dismissViewControllerAnimated(true,completion: nil)
    }

    func imagePickerControllerDidCancel(picker: UIImagePickerController) {
       self.dismissViewControllerAnimated(true,completion: nil)
    }
}

如果我单击取消或选择和图像,选择器控制器将正确解除.当我点击后退按钮返回TableView时出现问题,我收到:

Unbalanced calls to begin/end appearance transitions for <TestViewController: 0x7fb882a72380>.

TestViewController非常基础,为什么会这样呢?

解决方法

如果您尝试在上一个事务(动画)正在进行时推送新的视图控制器,则会出现此问题.因此,请检查您的代码流并进行适当的更改.检查你的解雇并呈现视图动画.您可以使用属性setAnimation’YES / NO’解决此问题

设置动画:不,可能会解决您的问题

原文链接:https://www.f2er.com/iOS/334485.html

猜你在找的iOS相关文章