scrollview应包含self.view的所有子视图(我使用self.view.subviews添加)。
如果DeviceType.IS_IPHONE_4_OR_LESS {
//Add Scrollview to self.view
let scrollview : UIScrollView = UIScrollView(frame: CGRectMake(0,0,320,480))
scrollview.showsVerticalScrollIndicator = true;
scrollview.scrollEnabled = true;
scrollview.userInteractionEnabled = true;
// scrollview.addSubview(self.view) /
let total : NSArray = (self.view.subviews as NSArray).copy() as! NSArray
//Add elements to scrollview but subviewes don't get scroll
for subview in total
{
scrollview.addSubview(subview as! UIView)
}
/// Results in blank white screen. Reason: May be scrollview & self.view pointing to same objects
for subview in self.view.subviews {
subview.removeFromSuperview()
}
self.view.addSubview(scrollview)
scrollview.contentSize = CGSizeMake(self.view.bounds.size.width, self.view.bounds.size.height+200)
}
我知道Size class&给问题可以解决。