这个问题困扰我有一段时间了。我在 UITabBarController
中放置了一个 UISplitViewController
,其中主视图是一个表格视图。当我点击单元格时,会出现一个非常基本的视图控制器,只有一个居中的 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
非常基础,所以为什么会发生这种情况呢?
tableView
时,也许tableView
再次尝试呈现此 VC? - Schemetrical