addSubview无法正确显示viewController中的所有内容?

时间:2016-02-27 14:23:37

标签: ios addsubview uicontainerview presentviewcontroller

就我而言,我的视图层次结构:

UIViewController
      View
        container view + button
          (in container view)  tableview

enter image description here

我想将此视图控制器显示为左侧幻灯片菜单

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

enter image description here

当我使用它时,它只显示按钮但不显示表格视图

view.addSubview(leftSlideMenu.view)

enter image description here

0 个答案:

没有答案