美文网首页
Add UIViewControllers into Scrol

Add UIViewControllers into Scrol

作者: hoody | 来源:发表于2015-02-01 15:23 被阅读40次

    Add UIViewController to a scroll view

        scrollView.addSubview(tutorialStep.view)
    
        addChildViewController(tutorialStep)
        tutorialStep.didMoveToParentViewController(self)
    

    Visual alignment for the views

        let views = ["view": view, "page1": page1.view, "page2": page2.view, "page3": page3.view, "page4": page4.view, "page5": page5.view]
    
        let verticalConstraints =
          NSLayoutConstraint.constraintsWithVisualFormat(
            "V:|[page1(==view)]|", options: nil, metrics: nil, views: views)
        NSLayoutConstraint.activateConstraints(verticalConstraints)
    
        let horizontalConstraints =
          NSLayoutConstraint.constraintsWithVisualFormat(
            "H:|[page1(==view)][page2(==view)][page3(==view)][page4(==view)][page5(==view)]|", options: .AlignAllTop | .AlignAllBottom, metrics: nil, views: views)
        NSLayoutConstraint.activateConstraints(horizontalConstraints)
    

    相关文章

      网友评论

          本文标题:Add UIViewControllers into Scrol

          本文链接:https://www.haomeiwen.com/subject/wuolxttx.html