uicollectionviewcell

UICollectionView flowLayout not wrapping cells correctly

一世执手 提交于 2019-11-26 15:40:41
I have a UICollectionView with a FLowLayout. It will work as I expect most of the time, but every now and then one of the cells does not wrap properly. For example, the the cell that should be on in the first "column" of the third row if actually trailing in the second row and there is just an empty space where it should be (see diagram below). All you can see of this rouge cell is the left hand side (the rest is cut off) and the place it should be is empty. This does not happen consistently; it is not always the same row. Once it has happened, I can scroll up and then back and the cell will

How to set cell spacing and UICollectionView - UICollectionViewFlowLayout size ratio?

梦想与她 提交于 2019-11-26 14:52:20
I'm trying to add UICollectionView to ViewController , and I need to have 3 cells 'per row' without blank space between cells (it should look like a grid). Cell width should be one third of screen size, so I thought that the layout.item width should be the same. But then I get this: If I reduce that size (by 7 or 8 pixels e.g.), it's better, but the third cell in row is not completely visible, and I still have that blank space (top & bottom, and left & right) . class ViewController: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource { var collectionView:

Dynamic size UICollectionView cell

六眼飞鱼酱① 提交于 2019-11-26 12:55:19
问题 1) How can i achieve as shown in image with UICollectionView ? 2) I\'ve tried -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath method & passed different sizes but it leaves out spaces between cells. Can i empty those spaces? I want different height & width for every cell Current output: . 回答1: Sorry this is super late... But maybe this will help people who haven't found an answer

UICollectionView animations (insert/delete items)

白昼怎懂夜的黑 提交于 2019-11-26 12:09:18
问题 I\'d like to customize the animation styles when a UICollectionViewCell is inserted and/or deleted. The reason why I need this is that by default I see that inserting a cell has a smooth fade in animation, however deleting a cell has a combination of move-to-the-left + fade out animation. I would be very happy with this if not for one problem. After I delete a cell, it is still reused when I add new ones, and when it\'s reused it\'s added not with the default fade in effect, but instead it\'s

Autoresizing issue of UICollectionViewCell contentView's frame in Storyboard prototype cell (Xcode 6, iOS 8 SDK) happens when running on iOS 7 only

我的未来我决定 提交于 2019-11-26 11:59:29
I'm using Xcode 6 Beta 3, iOS 8 SDK. Build Target iOS 7.0 using Swift. Please refer to my problem step by step with screenshots below. I have a UICollectionView in Storyboard. 1 Prototype UICollectionViewCell which contains 1 label in the centre (no autoresizing rule). Purple background was to mark a contentView that is generated in runtime by the Cell I guess. That view will be resized properly base on my UICollectionViewLayoutDelegate eventually, but not on iOS 7. Notice that I'm using Xcode 6 and the problem only happens on iOS 7. When I build the app on iOS 8. Everything is okay. Note:

UICollectionView adding UICollectionCell

百般思念 提交于 2019-11-26 11:59:04
问题 When I try to put UICollectionCell to UICollectionView in Interface Builder I can\'t put it with unknown reasons. The cell is going to the tools bar without adding to UICollectionView I am using: iOS SDK 6.0 XCode 4.5.1 I don\'t use Storyboard 回答1: Only UICollectionView inside StoryBoard have UICollectionViewCell inside. If use XIB, create a new XIB with CellName.xib, add CollectionViewCell to it, specify name of UICollectionView custom class. After that use registerNib. Sample code: https:/

Why is UICollectionViewCell's outlet nil?

霸气de小男生 提交于 2019-11-26 10:09:53
问题 I have created a custom UICollectionViewCell in Interface Builder, binded views on it to the class, and then when I want to use and set a string to the label on the string, tha label has a nil value. override func viewDidLoad() { super.viewDidLoad() // Register cell classes self.collectionView.registerClass(LeftMenuCollectionViewCell.self, forCellWithReuseIdentifier: \"ls\") } override func collectionView(collectionView: UICollectionView!, cellForItemAtIndexPath indexPath: NSIndexPath!) ->

Auto Layout in UICollectionViewCell not working

試著忘記壹切 提交于 2019-11-26 09:15:52
问题 I have a simple UICollectionView with cells that have a single UITextView. The UITextView is constrained to the edges of the cell, so they should stay the same size as the cell size. The problem I\'m having is that for some reason these constraints are not working when I specify the cell size via collectionView:layout:sizeForItemAtIndexPath:. I have the cell size set to 320x50 in the Storyboard. If I return a size with 2 times the height of the cell size with sizeForItemAtIndexPath:, the

UICollectionView Set number of columns

限于喜欢 提交于 2019-11-26 08:41:06
问题 I just started learning about UICollectionViews. I\'m wondering if anyone knows how to specify the number of columns in a collectionview. The default is set to 3 (iPhone/portrait). I\'ve looked at the documentation and can\'t seem to find a concise answer. 回答1: CollectionViews are very powerful, and they come at a price. Lots, and lots of options. As omz said: there are multiple ways you could change the number of columns I'd suggest implementing the <UICollectionViewDelegateFlowLayout>

Access Firebase variable outside Closure

感情迁移 提交于 2019-11-26 08:38:09
问题 I\'m trying to use Firebase to set the number of cells in my CollectionView. I tried to create a local variable and set that to the same value as the Firebase variable but when I try use it outside the function it doesn\'t work. I also tried setting it in ViewWillAppear but it didn\'t work. I set the nav bar title to view the value. When it was set in the closure I got the correct value, when I wrote that outside the closure (after the firebase function), it gave a value of 0. I\'m using