如何使用插入下一页的页面创建UIScrollView?
https://i.stack.imgur.com/oMDUW.png
我的当前代码如下:
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))
}
}