0
我使用稍微修改后的版本,从WWDC发现苹果公司的CircleLayout:https://github.com/mpospese/CircleLayout。逆时针iOS CircleLayout
我现在的代码在顶部绘制第一个元素,然后以顺时针方式绘制其余的元素。我怎样才能使用这段代码,使布局从顶部的第一个元素开始,沿路径逆时针绘制下一个元素?我的三角学有点生疏。
相信需要改变是代码部分:
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path
{
UICollectionViewLayoutAttributes* attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:path];
attributes.size = CGSizeMake(ITEM_SIZE, ITEM_SIZE);
attributes.center = CGPointMake(_center.x + _radius * cosf(2 * path.item * M_PI/_cellCount - M_PI/2),
_center.y + _radius * sinf(2 * path.item * M_PI/_cellCount - M_PI/2));
return attributes;
}
电流:
期望:
+1作品。谢谢! – btl