[英]How do i make this background image static behind the collection view
here is my code, I have basically worked most of my problem out, however the background of my collection view is scrolling in a pattern behind my collection view... All of this scene is made programattically... I am wanting to make the background image that I have, but I want the colleciton view to scroll over it.这是我的代码,我基本上已经解决了我的大部分问题,但是我的收藏视图的背景正在以我的收藏视图后面的模式滚动......所有这些场景都是以编程方式制作的......我想要制作我拥有的背景图像,但我希望收集视图滚动它。 But currently the background is scrolling with the text.但目前背景正在随着文本滚动。
// NSString *userId = PFUser currentId;
PFQuery *query1 = [PFQuery queryWithClassName:PF_USER_CLASS_NAME];
[query1 whereKey:PF_USER_OBJECTID equalTo:[PFUser currentId]];
[query1 findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error)
{
NSLog(@"madeIt");
PFUser *user = [objects firstObject];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:user[PF_USER_BACKGROUND]]]];
self.collectionView.backgroundColor = [UIColor colorWithPatternImage:image];
//NSLog(user[PF_USER_BACKGROUND]);
}];
Set this as UIViewController's background color:将此设置为 UIViewController 的背景颜色:
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
And set UICollectionView's background colour as clear colour:并将 UICollectionView 的背景颜色设置为清晰颜色:
self.collectionView.backgroundColor = [UIColor clearColor];
Also, set UICollectionViewCell's background colour as clear colour, if required:此外,如果需要,将 UICollectionViewCell 的背景颜色设置为清晰颜色:
cell.backgroundColor = [UIColor clearColor];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.