- 图片水平滚动。
- 根据位置有缩放效果。
- 屏幕中间的图片会停到中间的位置。
UISegmentedControl
。
This is likely occurring because the flow layout subclass _01_scroll_card.CustomLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them
XCode 7: Copy Layoutattributes
override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let attributes = super.layoutAttributesForElementsInRect(rect)
var attributesCopy = [UICollectionViewLayoutAttributes]()
for itemAttributes in attributes! {
let itemAttributesCopy = itemAttributes.copy() as! UICollectionViewLayoutAttributes
// add the changes to the itemAttributesCopy
attributesCopy.append(itemAttributesCopy)
}
return attributesCopy
}