我正在使用 UIPageMenuController。单击按钮时,我必须转到第 3 页。 我正在尝试调用 will willMoveToPage 委托(delegate)方法,出现错误
willMoveToPage:index:]: 无法识别的选择器发送到实例
在我的代码下面:
let storyBoard = UIStoryboard.init(name: "Main", bundle: nil)
let yourVC = storyBoard.instantiateViewController(withIdentifier: "ProfileConnectionsController") as! ProfileConnectionsController
pageMenu?.delegate?.willMoveToPage!(yourVC, index: 2)
最佳答案
错误显示 willMoveToPage:index:]: unrecognized selector sent to instance 你没有实现委托(delegate)方法
第一步
确保一旦你在你的类中实现委托(delegate)
class ViewController:UIViewController,CAPSPageMenuDelegate
并确保一旦您确认委托(delegate)
pageMenu.delegate=self
第二步
After that you will be able to set up the following delegate methods inside of your parent view controller
确保调用方法一次
func willMoveToPage(controller: UIViewController, index: Int) {
if let getSubview=controller as! ProfileConnectionsController
{
getSubview.pageNumber=index
}
}
关于ios - CAPS 页面菜单 : willMoveToPage delegate method getting error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45452663/