1
我试图用this回购来创建一个PageMenu,就像你在Instagram上找到的那样。我有滑动功能工作,但滚动菜单不会像导航栏一样出现在导航栏下方。我看过Implementing PageMenu/initializing view controllers from storyboard,但它并没有真正帮助我的问题。我也尝试使用回购中提供的演示,并根据需要对其进行自定义,但是当我将其拖动到我的项目时,它将忽略滚动菜单。将PageMenu与Storyboards一起使用Swift 3
这是我在viewControler代码:
// Initialize view controllers to display and place in array
var controllerArray : [UIViewController] = []
let controller1 : TestTableViewController = TestTableViewController(nibName: "TestTableViewController", bundle: nil)
controller1.parentNavigationController = self.navigationController
controller1.title = "FAVOURITES"
controllerArray.append(controller1)
let controller2 : RecentsTableViewController = RecentsTableViewController(nibName: "RecentsTableViewController", bundle: nil)
controller2.title = "RECIPES"
controller2.parentNavigationController = self.navigationController
controllerArray.append(controller2)
// Customize menu (Optional)
let parameters: [CAPSPageMenuOption] = [
.menuItemSeparatorWidth(4.3),
.scrollMenuBackgroundColor(UIColor.white),
.viewBackgroundColor(UIColor(red: 247.0/255.0, green: 247.0/255.0, blue: 247.0/255.0, alpha: 1.0)),
.bottomMenuHairlineColor(UIColor(red: 33/255.0, green: 161/255.0, blue: 77/255.0, alpha: 1)),
.selectionIndicatorColor(UIColor(red: 33/255.0, green: 161/255.0, blue: 77/255.0, alpha: 1.0)),
.menuMargin(20.0),
.menuHeight(40.0),
.selectedMenuItemLabelColor(UIColor(red: 33/255.0, green: 161/255.0, blue: 77/255.0, alpha: 1.0)),
.unselectedMenuItemLabelColor(UIColor(red: 40.0/255.0, green: 40.0/255.0, blue: 40.0/255.0, alpha: 1.0)),
.menuItemFont(UIFont(name: "HelveticaNeue-Medium", size: 14.0)!),
.useMenuLikeSegmentedControl(true),
.menuItemSeparatorRoundEdges(true),
.selectionIndicatorHeight(2.0),
.menuItemSeparatorPercentageHeight(0.1)
]
// Initialize scroll menu
pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRect(x: 0.0, y: 0.0, width: self.view.frame.width, height: self.view.frame.height), pageMenuOptions: parameters)
// Optional delegate
pageMenu!.delegate = self
self.view.addSubview(pageMenu!.view)
}
,如果你能帮帮我。提前致谢! :)
所以这是字面上只是y值?但为什么它在演示中,没有设置y值?无论哪种方式,非常感谢你! – Chace
也许他们没有把它添加到导航控制器和欢迎:) – Sahil