uicollectionviewcell

Add more UICollectionViewCell to an existing UICollectionView

此生再无相见时 提交于 2019-12-09 02:49:57
问题 I'm trying to add some more cells to an existing UICollectionView , which is already filled with some cells. I tried to use the CollectionView reloadData but it seems to reload the entire collectionView and I just wanted to add more cells. Can anybody help me? 回答1: The UICollectionView class has methods to add/remove items. E.g., to insert an item at some index (in section 0 ), modify your model accordingly and then do: int indexPath = [NSIndexPath indexPathForItem:index]; NSArray *indexPaths

UICollectionView always auto sizing cells. Not using sizes returned from delegate

若如初见. 提交于 2019-12-08 19:31:55
问题 Recently upgraded to Xcode 11 / iOS13. Working on a new view controller. The UICollectionView is calling my sizeForItemAtPath delegate method, but it seems like the collection view is always choosing self sizing based on constraints. But I don't want it to! I tried setting the estimatedSize to 1x1 just to try and work around this. Didn't work. I've breakpointed on all the delegate / datasource methods and don't see anything out of the ordinary. I also came across this (

Shadow not showing on cell in iOS

半世苍凉 提交于 2019-12-08 16:25:19
问题 I am using UICollectionView to generate several thumbnails in a Master View. This works fine and I am able to place a border around the cells as well as apply border (corner) radius. The only thing that does not seem to stick is the shadow for each cell. Here is my code .... [cell.layer setBorderColor:[UIColor colorWithRed:213.0/255.0f green:210.0/255.0f blue:199.0/255.0f alpha:1.0f].CGColor]; [cell.layer setBorderWidth:1.0f]; [cell.layer setCornerRadius:7.5f]; [cell.layer setShadowOffset

UICollectionViewCell from xib file not showing up in UICollectionView

雨燕双飞 提交于 2019-12-08 13:35:19
问题 I have a custom xib file which contains a label and a UICollectionView . I have a second xib file for the collection view's cell with a custom subclass of UICollectionViewCell . The parent xib file's owner looks like below- import UIKit class PackageSizePickerVC: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { @IBOutlet weak var collection: UICollectionView! let sizes: [PackageSize] = { let small = PackageSize(title: "Small",

UICollectionView and images

安稳与你 提交于 2019-12-08 09:17:51
问题 I have a UICollectionView , and it works great, but I have a doubt. In my view I have a UICollectionViewCell and inside that I have a UIImage. The cell is linked to a blank view controller, and inside that I have a UIScrollView (for managing the zoom) and a UIImage (the full-size image). I wondered if there was some delegate or something that could handle the image opening process automatically (with zoom, etc.). Now I'm handling the zoom effect with UIScrollViewDelegate delegate and method

In a UICollectionView how can I preload data outside of the cellForItemAtIndexPath to use within it?

♀尐吖头ヾ 提交于 2019-12-08 08:13:19
问题 Figured out slow loading images were the behind the choppy slow effect of my collectionView. I've been reading different Q&A's all day and various forum posts. It looks like the best way to solve this issue is to have the data pre-loaded available for the cellForItemAtIndexPath to be able to take what it needs. I'm not sure how I can do this. I'm using parse as my backend, but sure if given a rough example I'd be able to figure out how to do it. From what I've seen so far I need a separate

Why are UICollectionViewCells no longer visibile after assigning a UICollectionViewLayout to the UICollectionView?

只愿长相守 提交于 2019-12-08 07:05:09
问题 My app has a UIViewController class; inside this class I connect a UICollectionView loaded from a Storyboard. I'm creating a custom layout with the UICollectionViewLayout class. Here's what it looks like: class MyLayout: UICollectionViewLayout { override func prepareLayout() { super.prepareLayout() } override func collectionViewContentSize() -> CGSize { let attributes = super.collectionViewContentSize() return attributes } override func layoutAttributesForElementsInRect(rect: CGRect) ->

Asynchronous downloading in UICollectionView error with AFNetworking

我与影子孤独终老i 提交于 2019-12-08 05:58:14
问题 Hi I'm creating Uicollection view with list ofcatalogs, While tapping on cell the PDF have to download, Its working in one view perfectly but in another view gives the error * thread #1: tid = 0x4b2ce, 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56, queue = 'com.apple.NSURLSession-work', stop reason = EXC_BAD_ACCESS (code=1, address=0x0) frame #0: 0x000000018d14f9b8 CoreFoundation`CFURLCopyScheme + 56 frame #1: 0x000000018cdab96c CFNetwork`_urlIsHTTPish + 16 frame #2:

Cell disappearing after scrolling 2 - 3 times in UICollectionView

半腔热情 提交于 2019-12-08 05:57:08
问题 I'm facing a strange issue while scrolling my UICollectionView . It's showing a blank view without any cells in it. It strangely hides my cell or removes my cell, I don't know, but I'm unable to find any solution. I have tried these solutions from SO: 1st : Tried to create custom class of UICollectionViewFlowLayout and do as directed with all different methods but unable to solve my issue. 2nd : Tried below method to reattribute and recalculate my cell size : -(BOOL

UICollectionView fall back to UIScrollView

我与影子孤独终老i 提交于 2019-12-08 05:52:12
问题 I spent so much time implementing a collection view and subclassed UICollectionViewLayout only to find a bug in iOS 6 which makes cells disappear while scrolling if the cell is very large in size. Large UICollectionViewCell's disappearing with custom layout I am unable to find a solution so far, but I realize I may be able to do with just a UIScrollView instead of a UICollectionView and do not need cell reuse. Is there an obvious way to convert existing UICollectionView to a normal