这一直困扰我一段时间.我在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非常基础,为什么会这样呢?