简体   繁体   English

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

[英]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.

相关问题 如何在iOS中使用图像视图并使其位于其他图层的后面,使其成为背景? - How do I take in image view in iOS and make it go behind the other layers to make it the background? 如何在iOS 7下制作UISwitch而不采用背后视图的背景颜色? - How do I make a UISwitch under iOS 7 not take the background colour of the view behind it? 双击集合视图单元格时如何使图像可见? - How do I make image visible when collection view cell is double tapped? 如何在SpriteKit中将“相机视图”作为背景图像? - How can I make Camera View as my background image in SpriteKit? Swift 3-如何防止实例化视图控制器的背景消失在选项卡和导航栏的后面? - Swift 3 - How do I prevent instantiated view controllers from having their background disappear behind the tab and navigation bars? 如何在自己的图像视图中打开集合视图中的图像? - How do I open an image from a Collection View in its own Image View? 加载视图时,如何使图像覆盖屏幕? - How do I make an image cover the screen when a view is loading? 如何制作带有图像视图的无限页面滚动视图? - How do I make an infinite paged scroll view with image views? iOS:如何使静态或修复视图控制器上的背景 - iOS : How To Make Static or Fix Background on View Controller 如何防止表格视图在视图后滚动? - How do I prevent table view scrolling behind a view?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM