【发布时间】:2018-07-05 10:48:07
【问题描述】:
我注意到一个大问题,在从右到左的语言中,单元格的顺序没有正确颠倒,只有对齐是正确的。但仅适用于水平流布局,并且如果集合视图包含不同的单元格大小!是的,我知道这听起来很疯狂。如果所有单元格大小相同,则排序和对齐良好!
这是我到目前为止使用示例应用程序得到的结果(隔离以确保这是实际问题,而不是其他问题):
这是UICollectionViewFlowLayout(在 iOS 11 上)的内部错误吗?还是有什么明显的我遗漏的东西?
这是我的测试代码(没什么花哨的 + 带有 UICollectionView 的 XIB):
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 6
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "test", for: indexPath)
cell.backgroundColor = (indexPath.item == 0) ? UIColor.blue : UIColor.red
return cell
}
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: (10 * indexPath.item) + 20, height: 170)
}
【问题讨论】:
-
这看起来确实像一个错误。
-
我猜你可以找到关于任何奇怪问题的问题/答案。我就是喜欢 Stack Overflow!
标签: ios uicollectionview ios11 right-to-left uicollectionviewflowlayout