ios - CAPS 页面菜单 : willMoveToPage delegate method getting error

标签 ios swift xcode swift3

我正在使用 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/

相关文章:

ios - 无论 Firebase 中有多少 child ,都可以获取信息(Swift)

objective-c - 如何获得本地化的 Cancel、Done 等?

iphone - MPMoviePlayerController 选择哪种视频格式?

ios - 如何在 iOS 应用程序中为 iFrame 设置透明背景?

ios - UISplitView 与 header 以编程方式快速

ios - 在 Swift 中将不同的表格单元格导航到不同的 UIVewController

iOS UI 测试使用accessibilityIdentifier查找对象

ios - 目标 - C : Save zoomed caputre image from camera with GPUImage?

objective-c - 加密核心数据

iOS - 水平滑动 UICollectionViewCell