Add button as last UICollectionViewCell if all cells do not fit - ios

My UICollection view should have no more than two rows. If all cells do not fit, it should add "Show More" button as last cell. Cells have dynamic width and UICollectionView is non scrollable.
What are my options?
EDIT
I guess I should check if all cell fits into the screen, maybe using collectionView.visibleCells. If they do not fit, I should probably insert my "Show More" cell. Does this sound reasonable? Any other ideas?
Oh, and all cells have dynamic width.

Related

UIColecctionView with Sections [SWIFT] IOS

Hi People (Sorry for my English)
I have a problem. I want to create the next UI
I have a UIViewController It has a UITableView with a custom cell. This Custom cell has a UIImage, UILabel and UICollectionView.
My Problem begin here, in the UICollectionView
My UICollectionView has UILabel that represent a Sub Title and several buttons. one Sub Title has many buttons.
I already made this UI. I got the size buttons I got the width screen and I calculated the quantity of buttons that I can put by row. I also calculated
the sum of heigh of the Sub Titles and rows buttons and I set UICollectionView heigh, because I need to see all the items inside it.
I think that can be improved, because my code result is very confused.
My button has a constant width. I want to set my UICollectionView for that it will has a title section and rows buttons and the buttons change the row when the remaining space in the row is minor to width button.
Thanks :]

UICollectionView scroll whole page

I have a viewController with some text and under it a UICollectionView (about 50% of the page).
My problem is that when I scroll on the collectionView just the cells are being scrolled and not the whole page (the text + the collection cells).
You can think about it like on Instagram profile page (half info half collectionView), when you scroll on Instagram everything is being scrolled and not just the collection cells.
Anyone knows how can I do it?
Thanks!
Add the text content as separate cells on top of the UICollectionView.
Preferably, create a different section which would contain the cells with the top text.
Keep the backgroundColor/backgroundImage of these cells plain to give the effect that they are simply added as UILabels on a form. Doing so will also differentiate from the rest of the actual UICollectionViewCells.
Now, when you scroll the UICollectionView. It will give an effect that the text along with the cells are scrolled.
In Attribute inspector > Scroll View > check Paging enable
Thats because your text/UILabels doesn't belong within the UIScrollView of your UICollectionView, thus it will not be scrolled when the collectionView is. You could create a UICollectionViewCell for your text, include it within your collectionview and expand the collectionView to fit the screen or use a UICollectionViewController

An extra view appears in cell when pressing reorder dragger, why?

I have an UITableView with varying height, and when pressing reorder control, in the cell view structure a new view appears. Normally it is not a problem, but sometimes its height is quite big, and it overlaps, with cell below.
Why this view appears?
How can I get rid of it?
Or prevent to overlap other cells?
This view is part of the reorder mechanism and can't be removed. It is used to hide the cell content while you drag a screenshot view above the tableview.
If you set the cell clipsToBounds as YES, it should prevent it's content overlapping other cells.

How to create expandable table view in ios?

On click of table cell it will dynamically increase the label height and if user click on another cell previsoly opened cell will collapse and expand selected cell.I was try hard for this bt label text is not working well.I want increase the height of cell.exa- click on question cell it will expand the answer
Connect UITableViewCell to the code behind, have a state for that cell and on didSelectRowAtIndexPath change cell height to whatever value you want. Regarding of the state of the cell ( you can do this by checking its height as well ) shrink or expand the cell.
You can do this by adding another cell below "question" cell and make it visible or hidden on click as well.

How to set the height of prototype cells in an iOS table views

I have a table view with a prototype cell containing both disclosure and detail accessories. I want to use a font size of 12 in the cell and reduce the row height accordingly. Thus the size of the two accessory icons need to be reduced in size as well. I assumed this would be one of the more obvious things one might want to do with a table view but fail miserably in figuring out how?
Assuming you are have a nib or storyboard, you should see a resize handle on the cells when you select a cell in the editor. Just grab and resize.

Resources