ios - Adding a static background to a uicollectionview -
is possible add static background collectionview because @ moment background scrolls cells , image looks quite bad.
my code @ moment
collectionview.backgroundview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"bg.png"]];
there 2 ways you're asking.
add background
uicollectionviewsubview you're doing , implementscrollviewdidscroll:delegate method. inside method, set frame of background view based oncontentoffsetof collection view make appear static on screen. need set frame's y origincontentoffset.y, should work. (if there non-zerocontentinsetmay need bit of additional math right.)add background
superviewof collection view, underneath collection view. easier , more efficient solution since don't need mess contentoffset @ since background not in scroll view itself.
Comments
Post a Comment