Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios UIScrollView分页插入下一页_Ios_Swift_Swift3 - Fatal编程技术网

Ios UIScrollView分页插入下一页

Ios UIScrollView分页插入下一页,ios,swift,swift3,Ios,Swift,Swift3,如何创建包含插入下一页的页面的UIScrollView 我目前的代码如下: class scrollViewController: UIViewController, UIScrollViewDelegate { @IBOutlet weak var scrollView: UIScrollView! override func viewDidLoad() { super.viewDidLoad() let V1 = self.storybo

如何创建包含插入下一页的页面的UIScrollView

我目前的代码如下:

class scrollViewController: UIViewController, UIScrollViewDelegate {
    @IBOutlet weak var scrollView: UIScrollView!

    override func viewDidLoad() {
        super.viewDidLoad()

        let V1 = self.storyboard?.instantiateViewController(withIdentifier: "homeToCategory") as UIViewController!
        self.addChildViewController(V1!)
        self.scrollView.addSubview((V1?.view)!)
        V1?.didMove(toParentViewController: self)
        V1?.view.frame = scrollView.bounds

        let V2 = self.storyboard?.instantiateViewController(withIdentifier: "FeatureViewController") as UIViewController!
        self.addChildViewController(V2!)
        self.scrollView.addSubview((V2?.view)!)
        V2?.didMove(toParentViewController: self)
        V2?.view.frame = scrollView.bounds

        var V2Frame: CGRect = V2!.view.frame
        V2Frame.origin.x = self.view.frame.width
        V2?.view.frame = V2Frame

        self.scrollView.contentSize = CGSize(width:(self.view.frame.width) * 2, height: (self.view.frame.height))
        self.scrollView.contentOffset = CGPoint(x: (self.view.frame.width) * 1, y: (self.view.frame.height))
    }
}