Điều này đã khiến tôi khó chịu trong một thời gian. Tôi có một số UISplitViewController
bên trong một số UITabBarController
. Chế độ xem chính là một TableView. Khi tôi nhấp vào một ô, tôi sẽ hiển thị bộ điều khiển chế độ xem cơ bản chỉ với một trung tâm UIButton
. Đây là mã cho bộ điều khiển chế độ xem:Cuộc gọi nhanh không cân bằng để chuyển đổi giao diện bắt đầu/kết thúc cho
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)
}
}
Nếu tôi nhấp vào hủy hoặc chọn và hình ảnh, trình điều khiển bộ chọn sẽ loại bỏ chính xác. vấn đề này được đưa ra khi tôi nhấp vào nút quay lại để trở về TableView, tôi nhận được:
Unbalanced calls to begin/end appearance transitions for <TestViewController: 0x7fb882a72380>.
các TestViewController
là rất cơ bản, vậy tại sao điều này sẽ xảy ra?
Khi bạn quay lại 'tableView', có lẽ' tableView' đã cố gắng trình bày vc này một lần nữa? – Schemetrical