在 iOS 中显示专辑封面上的一些图像
Display some images on album cover in iOS
我想在我的应用程序的专辑封面上显示一些图像,例如下面的图像。
编辑:-
我想在启用分页的情况下在 UICollectionViewCell 和 collectionView scrollDirection Horizontal 中显示此视图。
任何帮助将不胜感激。提前致谢。
不知道你是否理解正确。
如果你想做我在图片上看到的,试试这个:
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];
我想在我的应用程序的专辑封面上显示一些图像,例如下面的图像。
编辑:-
我想在启用分页的情况下在 UICollectionViewCell 和 collectionView scrollDirection Horizontal 中显示此视图。
任何帮助将不胜感激。提前致谢。
不知道你是否理解正确。 如果你想做我在图片上看到的,试试这个:
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];