uicollectionreusableview

iOS -How to Add GADBannerView to UICollectionReusableView

ぐ巨炮叔叔 提交于 2019-12-11 17:58:40
问题 I'm adding my bannerView inside a collectionView header. It won't let me set the bannerView.rootViewController as self to the headerView because it's not a UIViewController. I can always implement the required properties inside the viewController that has the collectionView but then how do I load the bannerView? class HeaderView: UICollectionReusableView { var bannerView: GADBannerView = { let view = GADBannerView() view.translatesAutoresizingMaskIntoConstraints = false return view }()

How to load image with SDWebImage correctly in UICollectionView in swift

放肆的年华 提交于 2019-12-11 16:39:32
问题 I'm facing the following problem, well I have a custom collection view, where I upload an image from the URL I get from a service, everything works fine at the moment but sometimes when scrolling or when I leave the screen and return, my collection view customized it is altered, it does not load correctly, I have seen several posts where they present the same problem in different cases, but trying to conclude that my problem is at the moment of using the SDWebImage library. I have seen that

UICollectionView header width

三世轮回 提交于 2019-12-10 21:15:37
问题 In my UICollectionViewFlowLayout subclass I have this: self.headerReferenceSize = CGSizeMake(280, 44); However the header is displayed with a width of 320, which is the width of the collection view. This is correct according to the docs: During layout, only the size that corresponds to the appropriate scrolling direction is used. For example, for the vertical scrolling direction, the layout object uses the height value returned by your method. (In that instance, the width of the header would

add custom header to collection view swift

与世无争的帅哥 提交于 2019-12-08 17:10:05
问题 I am trying to add header to collectionView using custom xib file. I created the xib file with class implementing UICollectionReusableView . In collectionViewController I registered the xib file like this: self.collectionView.register(UINib(nibName: HCollectionReusableView.nibName, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: HCollectionReusableView.reuseIdentifier) and after that in viewForSupplementaryElementOfKind I did let header =

Transparent sticky header ui collectionview don't show cells underneath

女生的网名这么多〃 提交于 2019-12-08 07:59:53
问题 I want a sticky header that shows the views behind the collectionview, but not the collectionview cells as they pass under. Masking the collectionview masks the supplementaryview headers, and not masking them they are visible as they pass under 来源: https://stackoverflow.com/questions/44739618/transparent-sticky-header-ui-collectionview-dont-show-cells-underneath

UICollectionview scrollToItemAtIndexPath, not loading visible cells until animation complete

余生颓废 提交于 2019-12-07 13:35:23
问题 I have a UICollectionView with 142 Cells. 7.5 are visible at any one time. I'm moving a cell from indexPath 0 to say 100. But I also want to scroll to that new position. The code below works fine. But it animates the move and scroll, but then loads the cells in front of and behind the central/moved cell afterwards. I think its because the cells are reusable. but with 142, I can't pre-load all of them Its not the nicest effect, I would like to pre-load the cells surrounding the new position, 4

Difference between dequeueReusableCellWithReuseIdentifier: and cellForItemAtIndexPath:

安稳与你 提交于 2019-12-07 08:38:53
问题 I have been wondering why my code works well with cellForItemAtIndexPath: & not with dequeueReusableCellWithReuseIdentifier: while fetching collection view cells. Here is my code: This one works Fine: NSInteger numberOfCells = [self.collectionView numberOfItemsInSection:0]; for (NSInteger i = 0; i < numberOfCells; i++) { myCustomCollectionCell *cell = (myCustomCollectionCell *)[self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]]; //here I use the cell.. }

Transparent sticky header ui collectionview don't show cells underneath

大憨熊 提交于 2019-12-06 16:07:51
I want a sticky header that shows the views behind the collectionview, but not the collectionview cells as they pass under. Masking the collectionview masks the supplementaryview headers, and not masking them they are visible as they pass under 来源: https://stackoverflow.com/questions/44739618/transparent-sticky-header-ui-collectionview-dont-show-cells-underneath

UICollectionview scrollToItemAtIndexPath, not loading visible cells until animation complete

妖精的绣舞 提交于 2019-12-05 23:29:38
I have a UICollectionView with 142 Cells. 7.5 are visible at any one time. I'm moving a cell from indexPath 0 to say 100. But I also want to scroll to that new position. The code below works fine. But it animates the move and scroll, but then loads the cells in front of and behind the central/moved cell afterwards. I think its because the cells are reusable. but with 142, I can't pre-load all of them Its not the nicest effect, I would like to pre-load the cells surrounding the new position, 4 before and 4 after indexPath 100, and then see the animation of the move and scroll. can you help

Difference between dequeueReusableCellWithReuseIdentifier: and cellForItemAtIndexPath:

倾然丶 夕夏残阳落幕 提交于 2019-12-05 16:33:24
I have been wondering why my code works well with cellForItemAtIndexPath: & not with dequeueReusableCellWithReuseIdentifier: while fetching collection view cells. Here is my code: This one works Fine: NSInteger numberOfCells = [self.collectionView numberOfItemsInSection:0]; for (NSInteger i = 0; i < numberOfCells; i++) { myCustomCollectionCell *cell = (myCustomCollectionCell *)[self.collectionView cellForItemAtIndexPath:[NSIndexPath indexPathForItem:i inSection:0]]; //here I use the cell.. } While this compiles well, but not working (the changes I perform on cell is not depicted) NSInteger