Vatsal Shukla
Vatsal Shukla

Reputation: 1272

Display some images on album cover in iOS


i want to display some images on album cover on my app like bellow image.
enter image description here
EDIT:-
i want to display this view in UICollectionViewCell and collectionView scrollDirection Horizontal with paging enabled.


any help will be appreciated. and thanks in advance.

Upvotes: 0

Views: 80

Answers (1)

Jiri Zachar
Jiri Zachar

Reputation: 587

I do not know if you understand the question correctly. If you want to do what I see on the picture, so try this:

UIView *cover = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 500, 500)];
cover.backgroundColor = [UIColor blueColor];
int width = 200;
int height = 350;

int posx = 100;
int posy = 50;
for (int i = 0; i < 10; i++) {
    //craete images
    UIView *imagebg = [[UIView alloc] initWithFrame:CGRectMake(posx + arc4random_uniform(20), posy + arc4random_uniform(20), width, height)];
    imagebg.backgroundColor = [UIColor whiteColor];
    UIImageView *image = [[UIImageView alloc] initWithFrame:CGRectMake(20, 20, width - 40, height - 50)];
    image.image = [UIImage imageNamed:@"loading-screen.png"];
    [imagebg addSubview:image];

    //rotate
    double rads = arc4random_uniform(100)/10;
    CGAffineTransform transform = CGAffineTransformRotate(imagebg.transform, rads);
    imagebg.transform = transform;

    //add as subview
    [cover addSubview:imagebg];
}

[self.view addSubview:cover];

Upvotes: 1

Related Questions