UIViewControllerTransitioningDelegate错误

时间:2017-06-29 12:26:49

标签: ios xcode swift3

我正在尝试制作侧边栏。以下是后菜单的代码。扩展MainViewController和UIViewControllerTransitioningDelegate = self 分别使用未声明的类型和使用未解析的标识符

import UIKit
class HomeVC: UIViewController {




@IBAction func menu(_ sender: UIBarButtonItem) {
     performSegue(withIdentifier: "openMenu", sender: nil)
}



var data : String = ""


@IBOutlet weak var welcome: UILabel!


override func viewDidLoad() {
    super.viewDidLoad()

     welcome.text = data
}


}

func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
{
if let destinationViewController = segue.destination as? MenuVC
{
    destinationViewController.UIViewControllerTransitioningDelegate = self
}
}

extension MainViewController: UIViewControllerTransitioningDelegate {
func animationControllerForPresentedController(presented: UIViewController, 
presentingController presenting: UIViewController, sourceController source: 
UIViewController) -> UIViewControllerAnimatedTransitioning? {
    return PresentMenuAnimator()
}
}


/*
// MARK: - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    // Get the new view controller using segue.destinationViewController.
    // Pass the selected object to the new view controller.
}
*/

0 个答案:

没有答案