uicollectionview

sizeForItemAtIndexPath getting called for all indexes before load - I am pretty sure I am either running into a UICollectionView bug OR a poor design

牧云@^-^@ 提交于 2019-12-22 19:32:32
问题 I am able to reproduce this on a very simple standalone app. I have a collectionView which I want to make circular/loop so the elements repeat again and again (aka when user is at the last element in array, it shows the first element again after. And if they are at the first and scroll left, it shows the last element again). So it's a never ending collectionView. So for a simple example, let's use days of week: ....Sunday, Monday, Tuesday, Wednesday..Saturday, Sunday, Monday.... In order to

Label text in UICollectionViewCell not updating

前提是你 提交于 2019-12-22 18:37:41
问题 I'm trying to change the text of a UILabel in a UICollectionViewCell after the UICollectionViewCell has loaded, when tapping a button . But the label doesn't update on the screen. The console shows that the text property of the label is updated, but it seems the label isn't redrawn with the new text. Is this a known problem with UICollectionViewCells ? Some kind of caching issue, perhaps? Do I need to reload the cell, or the entire collection view for the update to show? 回答1: Because the cell

UICollectionView Scrolling issue

*爱你&永不变心* 提交于 2019-12-22 18:25:10
问题 I am developing an iPhone app that consists of UICollectionViews on UITableView To make each Collection scrolls horizontally . All steps are work perfectly except when I start to scroll each UICollectionView the UICollectionViewCell method is reuse and I am getting a problem with the label , the problem in the image below I faced this issue with the title of each collection on scrolling the table view and I did this NSString *CellIdentifier = [NSString stringWithFormat:@"CellId%d%d",indexPath

UICollectionView custom flow layout crashes on scrolling

纵饮孤独 提交于 2019-12-22 18:24:06
问题 I am creating a custom flowLayout with section headers. here is my flowLayout.swift import UIKit class FlowLayout: UICollectionViewFlowLayout { override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? { // let attributesForElementsInRect = super. var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() // unwrap super's attributes guard let attributesForElementsInRect = super.layoutAttributesForElementsInRect(rect) else { return nil

How to get section of UITableView from inside a child UICollectionview

拜拜、爱过 提交于 2019-12-22 18:20:12
问题 I have a UITableView with a UICollectionView within each of its rows like the illustration below. source: https://ashfurrow.com/blog/putting-a-uicollectionview-in-a-uitableviewcell-in-swift/ The intention of my app is to display a character set of a language within each table view row. Each character is contained within a collection view cell of the collectionview within the corresponding row. The problem I am having is that the english character set is being displayed for every tableview row

Issue with Duplicate Messages When navigating back to ViewController

喜你入骨 提交于 2019-12-22 17:29:48
问题 I have a ViewController that shows the user more information, then they click on a button and it sends them to my messageView which is a JSQ ViewController. The JSQViewController uses the collection View classes. When the user navigates back to the more information view and then hits the button to navigate to the message view again, the collection view duplicates my chat bubbles. I think I need to reset something to nil, but I am not sure what to set and where to set it. Here is my code:

Issue with Duplicate Messages When navigating back to ViewController

微笑、不失礼 提交于 2019-12-22 17:29:33
问题 I have a ViewController that shows the user more information, then they click on a button and it sends them to my messageView which is a JSQ ViewController. The JSQViewController uses the collection View classes. When the user navigates back to the more information view and then hits the button to navigate to the message view again, the collection view duplicates my chat bubbles. I think I need to reset something to nil, but I am not sure what to set and where to set it. Here is my code:

ios UICollectionView - setting auto height

谁说胖子不能爱 提交于 2019-12-22 13:53:12
问题 I'm using UICollection view to create 3x4 matrix of buttons. Its good looking in iPhone4 with has small height. Also collection view is not scrolling, as it shows 3x4 matrix buttons in available space. Now when I run the same app on iPHone5, i see lots of space at the bottom below the matrix of buttons. I would like collection view to increase the vertical spacing between the cells. Can some one guide me please? 回答1: Make UICollectionViewFlowLayout by math, for example: CGRect mainRect = [

Reloading UICollectionView causing flickering

依然范特西╮ 提交于 2019-12-22 11:24:55
问题 I have subclassed a CollectionView and using it using to display a collection of images in different categories. For example: Most Popular, Most Viewed. I access each category/page through a TabbarController. The classes I have are: Main class - MediaList - Base class for fetching and displaying media in a collection view depending on what type of media is requested. SubClasses - MostPopular and MostViewed are both very light classes that inherit from the main class. The problem is that when

Peek/Pop preview ignores cell corner radius in collection view

我与影子孤独终老i 提交于 2019-12-22 10:07:11
问题 I have added 3D Touch Peek/Pop functionality to my collection view cells and it works great, however I've noticed that the preview frame does not respect the corner radius of the cells. Here's my previewing function: func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? { let viewController = storyboard?.instantiateViewControllerWithIdentifier("scholarDetailViewController") as? ScholarDetailViewController let