uicollectionviewcell

Designing UICollectionView cells in nib with Interface Builder (without storyboard)

喜夏-厌秋 提交于 2020-01-01 03:52:26
问题 I am trying to design a custom UICollectionViewCell prototype (in Xcode 5.0.2), however Interface Builder doesn't let me add a cell to my UICollectionView while designing a nib. I can set the number of items (cells) and Interface Builder creates and displays cells perfectly if I'm using storyboard, but I can't add a cell to my collection view in a nib. I've tried: Drag and dropping collection view cell into collection view manually from the object library. (fails: doesn't let me drop the cell

How to scroll UICollectionViewCell programmatically in IOS?

本秂侑毒 提交于 2019-12-31 16:11:14
问题 I have a vertical UICollectionView with each cell taking up the entire self.view.frame I can easily swipe upwards to page to the next cell, but I would like to do the same thing with the press of a button. I've tried using: - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated And: - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated They work but they temporarily "White-Out" the currentCell to present the nextCell, while the swiping shows both cells during the

How to scroll UICollectionViewCell programmatically in IOS?

删除回忆录丶 提交于 2019-12-31 16:11:04
问题 I have a vertical UICollectionView with each cell taking up the entire self.view.frame I can easily swipe upwards to page to the next cell, but I would like to do the same thing with the press of a button. I've tried using: - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated And: - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated They work but they temporarily "White-Out" the currentCell to present the nextCell, while the swiping shows both cells during the

Setting size of UICollectionViewCell in a way that there is no interim spacing in between

空扰寡人 提交于 2019-12-31 07:09:08
问题 I'm using an UICollectionView on which I want to place seven cells side by side. The whole screen should be used for this. Currently, I'm using the width of the collection view and divide it by seven. Now I get an item width of 45.71429 on an iPhone 4. Between some cells there is an interim spacing. How can I handle this? I want to fill out the whole screen and all items should have the same size. One option which comes to my mind is to round the value and use the remaining value as inset.

UIButton does not function in collectionView cell

社会主义新天地 提交于 2019-12-31 06:25:08
问题 I am trying to create this collection view cells with kinda paging behavior. In every cell; I made a card flip animation. But flip function does not work. I know that function is OK because; before I create these UICollectionViewCell model, I tried everything in UICollectionView itself and it worked out perfect. But since I need paging behavior, I need multiple pages with card view inside and in every cell when user tabs the card it should flip. So, after I migrated all the code from

How to dynamically change the height of a UITableView Cell containing a UICollectionView cell in Swift?

£可爱£侵袭症+ 提交于 2019-12-31 06:24:28
问题 Currently, I have embedded a UICollectionViewCell in a UITableViewCell within one of the sections of my UITableView . I know how to dynamically change the cell's height in another section of my UITableView because I have a UITextView in another UITableViewCell that dynamically changes the height of the cell based on how much text is in the UITextView . The problem I have is in regards to the UITableViewCell containing the UICollectionViewCell . My UICollectionViewCell has one row of 4 images

HorizontalCollectionView Content width and spacing

倖福魔咒の 提交于 2019-12-31 03:57:11
问题 How can I make my horizontal collection view labels width to wrap the content width of the label and make them have equal spacing between each of them? Currently I have the collection view cell width as 100. If I increase the width to fit other labels, the shorter labels have more spacing between them. Any ideas will be appreciated. 回答1: Calculate the width of the label text first with the font associated with the text. extension String { func size(with font: UIFont) -> CGSize { let

writing events for UIswitch in collection view

試著忘記壹切 提交于 2019-12-31 03:07:10
问题 Hi I am trying to write events for UI switch and UI segmentation control in UI collection view. I declared the UIswitch and UIsegmentation control in collection view cell. @interface CollectionViewCell : UICollectionViewCell @property (strong, nonatomic) IBOutlet UISegmentedControl *mySegmentedControl; @property (strong, nonatomic) IBOutlet UISwitch *Myswitch; and access it from view controller.m - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *

UICollectionView showing wrong cells after scrolling - dequeue issue?

天涯浪子 提交于 2019-12-30 05:47:05
问题 I have a UICollectionView within a UIViewController. In the collectionView cellForItemAtIndexPath: method, it creates a series of custom cells based on the datasource. The custom cells in turn contain a UIView, subclassed to draw single PDF pages. It's set up in such a way as to split a PDF file into its single pages, so cell 1 contains PDF page 1, cell 2 contains PDF page 2 and so on. So far so good, here's my problem: When I scroll down, the UICollectionView starts displaying the wrong

UICollection View Scroll lag with SDWebImage

穿精又带淫゛_ 提交于 2019-12-30 03:24:26
问题 Background I have searched around SO and apple forum. Quite a lot of people talked about performance of collection view cell with image. Most of them said it is lag on scroll since loading the image in the main thread. By using SDWebImage , the images should be loading in separate thread. However, it is lag only in the landscape mode in the iPad simulator. Problem description In the portrait mode, the collection view load 3 cells for each row. And it has no lag or insignificant delay. In the