我在viewDidLoad和didRotateFromInterfaceOrientation方法中使用以下代码。名为topScrollView的scrollView在初始启动时不滚动,但在旋转后滚动。 我错过了什么?
func setLayoutOfGraphs(){
self.graphView.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y, self.view.bounds.width, 0.5 * self.view.bounds.height )
self.barGraphHostingView!.frame = CGRectMake(self.graphView.bounds.width, self.graphView.frame.origin.y, self.graphView.bounds.width, self.graphView.bounds.height)
self.pieGraph = CPTXYGraph(frame: self.graphView.bounds)
self.barGraph = CPTXYGraph(frame: CGRectMake(self.graphView.bounds.width, self.graphView.bounds.origin.y, self.graphView.bounds.width, self.graphView.bounds.height))
self.scrollView1.contentSize = CGSizeMake(self.scrollView1.frame.size.width, 1000)
self.scrollView2.contentSize = CGSizeMake(self.scrollView2.frame.size.width, 1000)
self.topScrollView.frame = CGRectMake(self.topScrollView.frame.origin.x, self.topScrollView.frame.origin.y, self.graphView.bounds.width, self.view.bounds.height*0.5 )
self.topScrollView.backgroundColor = UIColor.yellowColor()
self.topScrollView.contentSize = CGSizeMake(self.topScrollView.frame.width * 2 ,self.topScrollView.bounds.height)
self.pieGraph!.frame = self.graphView.bounds
}