繁体   English   中英

我如何使这个背景图像在集合视图后面是静态的

[英]How do i make this background image static behind the collection view

这是我的代码,我基本上已经解决了我的大部分问题,但是我的收藏视图的背景正在以我的收藏视图后面的模式滚动......所有这些场景都是以编程方式制作的......我想要制作我拥有的背景图像,但我希望收集视图滚动它。 但目前背景正在随着文本滚动。

   // 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]);

     }];

将此设置为 UIViewController 的背景颜色:

self.view.backgroundColor = [UIColor colorWithPatternImage:image];

并将 UICollectionView 的背景颜色设置为清晰颜色:

self.collectionView.backgroundColor = [UIColor clearColor];

此外,如果需要,将 UICollectionViewCell 的背景颜色设置为清晰颜色:

cell.backgroundColor = [UIColor clearColor];

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM