uicollectionviewlayout

How can UICollectionView supplementary views be inserted or deleted correctly

强颜欢笑 提交于 2019-12-14 01:25:57
问题 Short question: Is there a way to add and remove supplementary views like cells and section in a performBatchUpdates: block similar to the insertItemsAtIndexPaths: deleteItemsAtIndexPaths: or even reloadItemsAtIndexPaths: methods? Long explanation: I use a UICollectionView with sections. The cells are laid out like a grid and each line can have up to 6 cells. I add additional supplementary views if the total amount of cells do not fill up all lines of a section. The additional supplementary

How to change UICollectionViewLayoutAttributes of one cell

不羁的心 提交于 2019-12-13 16:05:29
问题 I would like to change the UICollectionViewLayoutAttributes attribute of one UICollectionViewCell without reloading or changing the layout object I did UICollectionViewLayoutAttributes *attributes = [collectionView layoutAttributesForItemAtIndexPath:indexPath]; attributes.transform = CGAffineTransformMakeScale(1.5, 1.5); But this isn't propagating to the cell - how can this be done? 回答1: -[UICollectionView layoutAttributesFor...] methods return copies of the layout attributes. You can't

UICollectionView doesn't scroll after setting contentInset

夙愿已清 提交于 2019-12-12 18:35:31
问题 I have a collection view that scrolls horizontally and spans its parent view's full width. My cheap way to achieve paging on it is to set the cell widths to be equal to 1/3 of the collection view width, and to set that same amount of width as left and right content insets. I disable scrolling in IB and replace with left and right swipe recognizers. My code almost works without setting contentInset , but setting the contentInset seems prevent any scrolling from happening - (void

Redraw cells after UICollectionViewFlowLayout invalidates its layout

拟墨画扇 提交于 2019-12-12 16:02:59
问题 When you invalidate layout on a UICollectionViewFlowLayout it creates a bunch of new layout attributes for each of your cells; it doesn't tell your cells to redraw however, which causes distortions in any Layer drawings. I don't want to tell my collection to reload its data because this removes any nice transitions you have between flow attributes : I have a grid layout transitioning into a coverflow for example. I need a way for the UICollectionViewController class to tell the cells to call

Collection view grid last row appears differently despite equal widths - swift iOS

时光毁灭记忆、已成空白 提交于 2019-12-12 10:59:36
问题 I've a fixed grid of collection view cells (UICollectionView) but the cells in the bottom row always appears with a slightly smaller width on screen. The frame size (or bounds) and calculated width used within collectionViewLayout: UICollectionViewLayout sizeForItemAt are the same for all rows. func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let settings = currentContents[indexPath

Dynamically change cell size according to image in a UICollectionView

本秂侑毒 提交于 2019-12-12 07:57:00
问题 I am displaying dynamic images recieved from server in a horizontal collection view. When I set up the collectionview I set this: -(void)setupCollectionView{ [self setupPageControlView]; self.screensCollectionView.delegate=self; self.screensCollectionView.dataSource=self; [self.screensCollectionView registerNib:[UINib nibWithNibName:@"FGAppScreensCollectionViewItemCell" bundle:nil] forCellWithReuseIdentifier:@"screenCell"]; UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout

UICollectionView Custom layout reloading issue in Swift

ぃ、小莉子 提交于 2019-12-12 05:39:00
问题 This is refrence link: https://www.raywenderlich.com/107439/uicollectionview-custom-layout-tutorial-pinterest I have implemented load more in UICollectionView at last cell , the data is getting downloaded, after download complete i want to reload collection collectionView.collectionViewLayout.invalidateLayout() self.collectionView.reloadData() let concurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) dispatch_async(concurrentQueue) { DataManager.sharedInstance

how to pass data between UICollectionViewLayout and UIViewController [duplicate]

守給你的承諾、 提交于 2019-12-12 03:17:23
问题 This question already has answers here : Passing Data between View Controllers (43 answers) Closed 4 years ago . I need to create a custom layout based on http call to an api. Based on result from api in loop i will populate an array from CollectionView In CustomLayout I need to use this array in order to draw correctly details in each row. In collectionView I use reload data after the data was added to array Thank YOu code: class epgViewController: UIViewController, UICollectionViewDelegate,

Disappearing UICollectionViewCells on landscape orientation

心已入冬 提交于 2019-12-12 02:25:35
问题 I have a problem managing my UICollectionsView with flowlayout and orientation. Basically, the problems happens when I switch to landscape, some of the UICollectionViewCells are missing. They reappear once I start scrolling. It should be able to show all the cell since there is so much more room on the contentSize. I even tried in my layout: - (BOOL) shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { return YES; } With the same results. Anyone have any ideas on this problem? I included

How to correctly animate change of size of a paged UICollectionView

蹲街弑〆低调 提交于 2019-12-11 20:09:12
问题 I have an iPad app similar to the iPad Keynote with a narrow overview on the left and a paged UICollectionView of my "slides" on the right. The collection view is using the default FlowLayout. Some of these slides are standard PDFs and some are embedded UIViewController s that have been scaled (with a CGAffineTransform ) and embedded in the cell. I'd like to smoothly animate the overview sidebar offscreen and zoom the current page cell to fullscreen. The collection view should allow paged