Reputation: 1360
I have a scrollView with a rectangular frame to display a set of subViews and page them, I would expect those other subViews to be hidden and only the current content displayed but instead I get all this overlap onto my screen.
if scrollViewHasBeenSetUp == false {
var index = 0
for event in eventList.events {
let match = getMatchCell(event)
match.frame = CGRect(x: index * Int(matchScrollView.frame.width), y: 0, width: Int(matchScrollView.frame.width), height: Int(matchScrollView.frame.height))
matchScrollView.contentSize = CGSize(width: Int(match.frame.width) * eventList.events.count, height: 120)
matchScrollView.addSubview(match)
index++
print("cell frame: \(match.frame)")
}
scrollViewHasBeenSetUp = true
}
Using the visual inspector you can see the scrollViews frame has been set correctly but its content still isn't being hidden.
Upvotes: 1
Views: 192
Reputation: 6369
Did you select clip subviews?
And I see your y is always 0,is it a vertical scroll view?
Upvotes: 2