uicollectionreusableview

UICollectionView sticky header disappears for while after inserting section when collection is overscrolled (bounce effect)

柔情痞子 提交于 2020-03-22 08:01:33
问题 I'm using UICollectionReusableView as a header of UICollectionView section. I enabled "sticky headers" with: let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout layout?.sectionHeadersPinToVisibleBounds = true I'm inserting new sections to collection with: collectionView.performBatchUpdates({ self.collectionView.insertSections(IndexSet(integersIn: collectionView.numberOfSections...viewModel.numberOfSections - 1)) }, completion: nil) If the insertion happens when

Custom Header in UICollectionView with Interface Builder without Storyboard

久未见 提交于 2020-01-13 01:57:22
问题 I'm trying to add a custom view to the header section of my UICollectionView . I have the xib file interface builder but I don't use storyboard. I have checked the Section Header in Interface Builder but doesn't appear any UICollectionReusableView, what can I do? 回答1: The easiest solution is to do is programatically (and keep your HeaderReusableView in another XIB file): [self.collectionView registerNib:[UINib nibWithNibName:@"ItemHeaderView" bundle:nil] forSupplementaryViewOfKind

Auto-sizing UICollectionView headers

偶尔善良 提交于 2020-01-12 19:31:35
问题 I'm trying to make a detail screen for a to-do list kind of app. Here's what the detail screen currently looks like: This is a UICollectionViewController , with a header. The header contains 2 UILabel objects, and a UITextView object. The layout of these objects is managed by a vertical UIStackView . A UIView is used to set a white background. I'm having some difficulties in defining the height of this UICollectionReusableView at runtime. Any advice is appreciated. 回答1: This is a bit of a

UICollectionReusableView - Missing return in a function

纵饮孤独 提交于 2020-01-10 18:14:12
问题 I had a weird problem running into considering a header of a UICollectionView . I basically used the code from: http://www.raywenderlich.com/78551/beginning-ios-collection-views-swift-part-2 func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "dd.MM.yyyy' - 'HH:mm'" //1 switch kind { //2 case

UICollectionView header view create programmatically and add?

五迷三道 提交于 2019-12-24 12:49:00
问题 I have created UICollectionView in storyboard and added header footer view its working fine.But My question is how to create UICollectionViewReusable view to add as SupplementaryView programatically.I tried but delegates not called.Please note that i have set delegate also.below code i have tried - (void)setUpCustomCollectionView { self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 40, 320, 500) collectionViewLayout:layout]; [self.collectionView registerClass:

Issue with placing cells in custom flow layout of UICollectionViews

拟墨画扇 提交于 2019-12-24 07:40:06
问题 I am trying to create a tag flow layout. To do this I followed a very nice tutorial https://codentrick.com/create-a-tag-flow-layout-with-uicollectionview/ I managed to create and customize the flow layout, but the cells are not aligned properly some times. Here is the screenshot from iphone 4S. I have two header sections also As you can see in section 1, the tags are not placed correctly. I am not understanding what is causing this issue. Here is my custom flow layout class import UIKit class

How to dynamically add labels and buttons in section header of UICollectionView?

给你一囗甜甜゛ 提交于 2019-12-23 15:57:46
问题 Please help me how I can add labels horizontally and similarly buttons horizontally but each button should align at down of each label like a another section. This should happen dynamically in the header of the UICollectionView as the number of labels and buttons is according to my data. I want to make a excel kind of layout and in header I want to show the above controls. Thanks in advance! I have done this- - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView

Display Section Header UICollectionReusableView

别来无恙 提交于 2019-12-23 02:22:33
问题 I was working on iOS application and I have several problem about using UICollectionView cell. This time, I want to ask about how to display the section header of UICollectionView (UICollectionReusableView) I already implement the function like below : public func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { switch kind { case UICollectionElementKindSectionHeader: let

Strange behavior when user scrolls the list of UIViewCollectionCells in my app (the data in each cell changes randomly)

不问归期 提交于 2019-12-14 03:08:04
问题 In my app I'm using UICollectionView and I've decided to use it as in the code below: class UserList: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate { @IBOutlet weak var tview: UICollectionView! let reuseIdentifier = "cell" var items = NSMutableArray() func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { let cell = tview.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath:

How can UICollectionView supplementary views be inserted or deleted correctly

强颜欢笑 提交于 2019-12-14 01:25:57
问题 Short question: Is there a way to add and remove supplementary views like cells and section in a performBatchUpdates: block similar to the insertItemsAtIndexPaths: deleteItemsAtIndexPaths: or even reloadItemsAtIndexPaths: methods? Long explanation: I use a UICollectionView with sections. The cells are laid out like a grid and each line can have up to 6 cells. I add additional supplementary views if the total amount of cells do not fill up all lines of a section. The additional supplementary