2

スナップショットに表示されている画像まで到達しました。

しかし、それでもその Y は下にあるだけで、X を適切に重ねて設定することはできません。

Y の画像は上下できますが、前の画像と同じ Y を持つことはできません。私はここにいます X の画像は前の画像に重ねる必要がありますが、どの画像の間にも距離を置くことはできません。

Yを設定できましたが、それでも画面の中央にあるはずで、下部ではなく、Xを設定できませんでした.

これは私が使用しているコードです

    CGFloat randomX = (arc4random()%100) *1.1;
    CGFloat randomY = (arc4random()%100) *.40;

    UICollectionViewLayoutAttributes* attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:path];

    NSLog(@"prevnode : %@",NSStringFromCGPoint(prevNodeCenter));

    attributes.size = CGSizeMake(ITEM_SIZE, ITEM_SIZE);
    attributes.center = CGPointMake(_center.x + _radius + randomX * cosf(2 * path.item * M_PI / _cellCount) ,
                                    _center.y  + _radius + randomY);

    NSLog(@"randomX : %f randomY : %f",randomX,randomY);
    NSLog(@"attrib center x : %f",attributes.center.x);

    /*
    if(attributes.center.x <= prevNodeCenter.x )
    {
        attributes.center = CGPointMake(prevNodeCenter.x+_radius+cosf(2 * path.item * M_PI / _cellCount), attributes.center.y);
    }
    if(attributes.center.x >= prevNodeCenter.x+_radius)
    {
        NSLog(@"its far");
    }
    */

     /*
    if(attributes.center.y > self.collectionView.frame.size.height)
    {
        attributes.center = CGPointMake(attributes.center.x, self.collectionView.frame.size.height/2);
    }*/

    prevNodeCenter = attributes.center;
    return attributes;
4

0 に答える 0