就我而言,我的视图层次结构:
UIViewController
View
container view + button
(in container view) tableview
我想将此视图控制器显示为左侧幻灯片菜单
let storyboard = UIStoryboard(name: "SlideMenu", bundle: nil)
let leftSlideMenu = storyboard.instantiateViewControllerWithIdentifier("leftSlideMenu") as! LeftSlideMenu
leftSlideMenu.view.frame = CGRectMake(view.frame.origin.x, view.frame.origin.y, 100, view.superview!.frame.size.height)
// this line is set the slide menu to right frame to only take a part of screen and looks like a "Slide Menu"
presentViewController(leftSlideMenu, animated: false, completion: nil)
// this is good and show all content in the view controller but the frame is not in control
当我使用它时,它只显示按钮但不显示表格视图
view.addSubview(leftSlideMenu.view)