uicollectionview

iOS - Collectionview images disappear on scrolling and sometimes overlaps

懵懂的女人 提交于 2019-12-25 11:52:45
问题 When downloading images from server and populating the collection view (grid 3 * n). I am getting glitch . I tried almost everything possible like making image view nil before reusing cell and using GCD for updating image view from main thread. But I'm still facing the glitch. Glitch is when I scroll the collection view , images downloaded are overlapped and sometimes disappear from the collection view cell. I have no idea what is causing the image to disappear (which were once downloaded).

Using Custom Layout Causes collectionViewFlowLayout delegate function not being called

こ雲淡風輕ζ 提交于 2019-12-25 09:47:49
问题 I am using TRMosaicLayout to achieve a SnapChat like layout. However, after using it, I noticed that viewForSupplementaryElementOfKind is no longer called. Any thoughts? func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView { print("THIS FUNCTION IS NO LONGER CALLED"); var view: UICollectionReusableView! = UICollectionReusableView(); switch kind { case UICollectionElementKindSectionFooter:

Removing a subview then adding it back

主宰稳场 提交于 2019-12-25 09:27:17
问题 I have a UICollectionViewCell with a gradient subview. In my view controller, I have buttons that are sorting CoreData and then reloadData() on the UICollectionView . To avoid my gradient subview to be drawn again and again (as it happened in the past), I implement removeFromSuperview() in prepareForReuse() . There I also implement a flag that keeps track of gradient existence so I still add a new gradient when cell is load. However after removing the gradient, my willMove(toSuperview: )

Dynamic UICollectionViewCell width with respect to frame width and aspect ratio

独自空忆成欢 提交于 2019-12-25 09:08:15
问题 This is a follow up question from UICollectionViewCell dynamic sizing for 4.4 and 5.5 inch While that solution is great, I'd like to generate a dynamic amount of item cells (kCellsPerRow) within the UIVIewController based on the device's width, aspect ratio, and amount of total items I have to display. I just can't figure out how to calculate the right amount of kCellsPerRow so that they are not too resized once they hit an aspect ratio limit. Here's what I have so far: var kCellsPerRow =

Trying to insert new items into UICollectionView but getting the same cells over and over

萝らか妹 提交于 2019-12-25 07:04:04
问题 My UICollectionView is set to have 3 rows and 3 sections. I am trying to insert a batch (array) 9 of items into the CollectionView, but with the following code below, I get the first 3 things in my batch displayed in all 3 sections. BATCH: blue, red, green, orange, fish, sand, hat, shoe, black CURRENT RESULT SHOWN: blue blue blue red red red green green green CURRENT CODE: ... [self.selectedSearches addObject:string]; [self.collectionView insertItemsAtIndexPaths:@[[NSIndexPath indexPathForRow

Toggle select / deselect state of a UICollectionView Cell on tap - Swift

大城市里の小女人 提交于 2019-12-25 06:51:03
问题 So first of all i've been stuck on this for a few days and spent a full day reading and trying many options on Stack Overflow already but non to my success What i'm trying to accomplish sounds simple and going over the Apple documentation it seems to me it should work https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionViewDelegate_protocol/#//apple_ref/occ/intfm/UICollectionViewDelegate/collectionView:shouldHighlightItemAtIndexPath: Basically what i'm trying to

ipad objective c using removeFromSuperview to remove UICollectionViewController throws an error

拈花ヽ惹草 提交于 2019-12-25 04:14:28
问题 So I'm customizing this control I found since I think it works very well except with this issue of mine: http://www.cocoacontrols.com/controls/fsverticaltabbarcontroller I wanted to load a UICOllectionViewCOntroller instead of a regular ViewController whenever an item is tapped on the sidebar. So I did this modification when selecting an item: - (void)setSelectedIndex:(NSUInteger)selectedIndex { NSLog(@"selected Index is %@", [NSNumber numberWithInt:selectedIndex]); NSLog(@"_selected Index is

Check if cell completely displayed in collectionview

不羁的心 提交于 2019-12-25 04:09:05
问题 I have a collection view where the cell is of the size exactly to the collectionView, so each cell should occupy the whole screen. I have implemented a functionality where the cell is snapped to the complete view whenever it's dragged or decelerated through the scroll. This is how the UX works. https://drive.google.com/open?id=1v8-WxCQUzfu8V_k9zM1UCWsf_-Zz4dpr What I want: As you can see from the clip, the cell snaps to the whole screen. Now, I want to execute a method after it snaps. Not

How to Implement DataSheet

扶醉桌前 提交于 2019-12-25 03:59:09
问题 I want to implement data sheet to display history of user. I want to implement that design like this: But I dont know how to do that...Can anyone please help me Edit: 回答1: Add the horizontal line at the specific position and the label at the position and it will look like this. Create a tableview and than in cellForRowAtIndexPath method add this code.. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *SimpleTableIdentifier;

UICollectionViewCell and UITextField text

余生颓废 提交于 2019-12-25 03:25:07
问题 I have custom UICollectionVIewCell with UILabel and UITextfield as it's property. They both IBOutlet to and connected in Storyboard. This cell get reused in a UICollection view. It get created depending on UILabel count array. So if array has three strings, this cell get created three times. User supposed to enter number in UITextfiled for relevant label. I want to save this number along with label in a dictionary. My problem is I can't get text from UITextfield. Don't know how to do that. I