我正在尝试从https://github.com/HighBay/PageMenu实现页面菜单。我使用instantiateViewControllerWithIdentifier而不是NibName来创建我的UIViewControllers。但我的控制器都没有添加到菜单页面。这是我的代码:
var pageMenu : CAPSPageMenu?
var controllerArray : [UIViewController] = []
let vc1 = UIStoryboard (name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("PeopleSearchTableViewController")
let vc2 = UIStoryboard (name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("HashtagsSearchTableViewController")
vc1.title = "People"
vc2.title = "Hashtags"
controllerArray.append(vc1)
controllerArray.append(vc2)
let parameters: [CAPSPageMenuOption] = [
.ScrollMenuBackgroundColor (UIColor.whiteColor()),
.SelectionIndicatorColor (UIColor (netHex: 0x3CBB5B, alpha: 100)),
.SelectedMenuItemLabelColor(UIColor (netHex: 0x3CBB5B, alpha: 100)),
]
pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRectMake(0.0, 0.0, self.view.frame.width, self.view.frame.height), pageMenuOptions: parameters)
self.view.addSubview(pageMenu!.view)
但它既不显示主题标签页面也不显示人物页面,我无法从人员切换到人质。有人可以帮忙吗?
谢谢!
答案 0 :(得分:0)
我遇到了同样的问题 - 您需要在self.addChildViewController(pageMenu!)
self.view.addSubview(pageMenu!.view)