uicollectionreusableview

Auto-sizing UICollectionView headers

北慕城南 提交于 2019-12-04 05:23:15
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. Friggles This is a bit of a hack, but seems to work. // showhere to keep a reference UICollectionReusableView * _cachedHeaderView;

Issues inserting into UICollectionView section which contains a footer

梦想与她 提交于 2019-12-03 17:43:43
问题 I've got a typical UICollectionView which is using UICollectionViewFlowLayout in a vertical fashion. I'm using a rest API with pagination to populate the collection view. In order to trigger the next page to download, I'm using the delegate when it asks for the footer layout: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ RDLoadMoreReusableView *view = [collectionView

Remove space between sections in collectionview

喜你入骨 提交于 2019-12-03 07:10:18
问题 How to adjust the spacing between sections of collection view. 回答1: Header height can be adjusted by adjusting the params of the collection view layout. Following is the code which works perfectly fine. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { if ([[sectionHeaderArray objectAtIndex:section] boolValue]) { return UIEdgeInsetsMake(10, 10, 10, 10); } return UIEdgeInsetsZero; }

Issues inserting into UICollectionView section which contains a footer

痴心易碎 提交于 2019-12-03 06:29:24
I've got a typical UICollectionView which is using UICollectionViewFlowLayout in a vertical fashion. I'm using a rest API with pagination to populate the collection view. In order to trigger the next page to download, I'm using the delegate when it asks for the footer layout: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath{ RDLoadMoreReusableView *view = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"RDLoadMoreReusableView" forIndexPath

UICollectionView custom line separators

北慕城南 提交于 2019-12-03 02:03:13
问题 I wanna making 2pt black separators in UICollectionView for our new app. Screenshot from our app is below. We couldn't use UITableView , because we have custom insert/delete animations, scrolling and parallax effects and so on. 回答1: I started with three ideas how to make it: implement these separators right inside the cells use solid black background with minimumLineSpacing , thus we will see background in spaces between cells use custom layout and implement this separators as decorations

Remove space between sections in collectionview

只愿长相守 提交于 2019-12-02 20:45:52
How to adjust the spacing between sections of collection view. Header height can be adjusted by adjusting the params of the collection view layout. Following is the code which works perfectly fine. - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { if ([[sectionHeaderArray objectAtIndex:section] boolValue]) { return UIEdgeInsetsMake(10, 10, 10, 10); } return UIEdgeInsetsZero; } Mayank Birani You can use the method to implement this: - (UIEdgeInsets)collectionView:(UICollectionView *

UICollectionReusableView - Missing return in a function

若如初见. 提交于 2019-11-30 11:45:48
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 UICollectionElementKindSectionHeader: //3 let h = collectionView.dequeueReusableSupplementaryViewOfKind(kind,

no UICollectionViewLayoutAttributes instance for -layoutAttributesForSupplementaryElementOfKind:

£可爱£侵袭症+ 提交于 2019-11-29 23:48:44
问题 The title is the error I'm getting and I have no idea why, but here is some information so hopefully someone on here can elucidate me. I have subclassed UICollectionViewFlowLayout as this saves me calculating the frames for the cell's myself (perhaps this is an issue?) in prepareLayout . I then use the UICollectionViewLayoutAttributes information to calculate a supplementary view that over lays it, I get the layout I desire. I use performBatchUpdates:completion: to add,remove and update the

Removing empty space, if the section header is hidden in the UICollectionView

杀马特。学长 韩版系。学妹 提交于 2019-11-28 17:47:13
I have two sections in UICollectionView . I want to show a section header in UICollectionView for only 1st section. Not in 0th section. So I tried to return nil in viewForSupplementaryElementOfKind : method for section == 0 and returns view for the section == 1 . It crashes and shows below error: Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes]: Here it is my code for the supplementary view. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:

Add a simple UIView as header of UICollectionView

六眼飞鱼酱① 提交于 2019-11-28 10:41:30
I have a UICollectionView . I would like to add a header. My header would only be a UILabel . I've : 1) selected "Section Header" as a Collection View accessory in the IB. 2) created a Collection Reusable View in the IB, on the side, declared as collectionViewHeader . 3) added those lines : - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath { if (kind == UICollectionElementKindSectionHeader) { return collectionViewHeader; } return nil; } But they are never called. Do I have to