uicollectionviewcell

UI-Issues while reordering UICollectionView with full-width and dynamic height cells

倖福魔咒の 提交于 2019-12-11 08:34:54
问题 I have a CollectionView with cells that have full-width and a dynamic (auto-layout-calculated) height. I do so by setting an estimated height: flowLayout.estimatedItemSize = CGSize(width: 200, height: 10) Then returning the full width and a arbitrary height in the delegate method. public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: collectionView.bounds.width,

UICollectionViewCell does not show images

≯℡__Kan透↙ 提交于 2019-12-11 08:23:32
问题 How do I get the image shown in the cell, using UICollectionViewCell? Running the below stated code, I get the following output in the debugger. MagazineCell initWithFrame is called and when reloading the data the setPhoto is called. If I would put the setPhoto code in the initWithFrame method a reload would have no effect. But the simulator does only show grey cells. No Image added, no backgroundcolor changed to yellow/red. What do I miss? [5230:70b] -[WebApi getSurroundImages] [Line 326] do

How to get the correct frame of UICollectionViewCell in it's subclass

拜拜、爱过 提交于 2019-12-11 08:08:37
问题 I have a UICollectionView and I set it's cellSize in viewDidLoad : let cellWidth = self.view.frame.width / 2 self.collectionViewFlowLayout.itemSize = CGSize(width: cellWidth, height: 100)` I try to add a gradient layer to my custom UICollectionViewCell . But the frame size is the one I set from storyboard. I can't get the correct, calculated frame size in my UICollectionViewCell subclass's layoutSubviews method. How am I going to get the correct frame size? 来源: https://stackoverflow.com

collectionView cellForItemAt not being called

和自甴很熟 提交于 2019-12-11 06:19:28
问题 I've got a UITableView where each prototype cell has a UICollectionView in it. This collection view is supposed to be a grid of images. I'm very new to Swift, and have googled for hours (and read plenty of StackOverflow articles), and cannot seem to find the correct answer to this question. How come collectionView cellForItemAt is not being called? I see that my collectionView numberOfItemsInSection method, and collectionView sizeForItemAt methods get called. I've made sure to assign my

Swift add button to UICollectionViewCell that opens new controller

南楼画角 提交于 2019-12-11 06:14:30
问题 I have a UICollectionViewCell header on a UICollectionViewController , and I've added a button to it. I would like for the button, when clicked, to push a new view controller atop the current one. The problem is that the button doesn't have access to the navigation controller of the UICollectionViewController , so I there's no way to directly push a controller from, say, a connector to the buttn (that I know of). Is there any way to achieve this? Maybe something can be overriden, such as a

UICollection horizontally scroll, so reduce the space between cell item

北城以北 提交于 2019-12-11 06:11:35
问题 I take UICollectionView and set horizontal scroll. Now In this one image view is there, All working perfect except cell spacing. In collectionView I set the Minimum Spacing for cells 0(Zero). But still Spaces is there. My output is like that.. But I need this type of output.. And one more thing is that I refer so many answer but still no idea what to do. I use Xcode 7.0 so I need solution in swift 2.0 and if possible then also request to give answer in swift 3.0. Please help me. Thanks in

Swift: tvOS IBAction for UIControl in Collection View cell never gets called

若如初见. 提交于 2019-12-11 05:53:27
问题 I know this has been asked many times, but I am still learning, I have tried all possible solutions here in S.O. and I haven't had luck a single time. So this is the issue: I am using Xcode 11 beta 3 (hopefully that ISN'T the issue!) I have a simple collection view in a view controller Inside the cell I have put a tvOS' TVPosterView - which inherits from UIControl and testing it by itself it does behave like a button (IBAction gets called). On the collection view there is the animation when I

My UICollectionView does not scroll smoothly using Swift

我是研究僧i 提交于 2019-12-11 05:45:50
问题 I have a CollectionView which dequeues a cell depending on the message type (eg; text, image). The problem I am having is that when I scroll up/down the scroll is really choppy and thus not a very good user experience. This only happens the first time the cells are loaded, after that the scrolling is smooth. Any ideas how I can fix this?, could this be an issue with the time its taking to fetch data before the cell is displayed? I am not too familiar with running tasks on background threads

Change same UICollectionViewCell layout for different views

巧了我就是萌 提交于 2019-12-11 04:57:27
问题 I have two views, B and C, and B inherits from C. C contains a CollectionView. Each cell is of type ProductsCollectionViewCell (Code below) When view C loads its products, this is what I get: In view B, I want to have the cells look like this : in view C, I have this: func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return GetViewCGSize(collectionView) } As you can see, I have used

iOS UICollectionViewController Not showing center cells. But can click on them

折月煮酒 提交于 2019-12-11 04:45:23
问题 I've created a custom UICollectionViewController . I have 2 albums I want to display - each have a bit different functionality but the views are essentially the same (custom cell sizes , etc.). From this base ViewController I am inheriting the 2 customized UICollectionViewController with the specific behavior I am seeking. The inheritance is UICollectionViewController -> GalleyViewController (my base class) -> CameraAlbumViewController . UICollectionViewController -> GalleyViewController (my