In swift 4, uicollectionView can I set minimumLineSpacing for only particular indexPath? - uicollectionview

In the picture I have made a UICollectionView like the top one.
But I want to make it like the bottom collectionView.
For particular indexPath I want more space between cells
I googled but I think there is no way to do that with minimumLineSpacingForSectionAt.
Is there a better way to do this?

This method "minimumLineSpacingForSectionAt" is used to give spacing between section not between cells. To achieve the above thing, you can return empty CollectionView cell or you can also return different size for this particular cell.

There is a better way to achieve this i.e. by using UICollectionViewFlowLayout. You need to subclass UICollectionViewFlowLayout, customise it and then assign this to you collection view.

Related

How to display tableview within a cell of other tableview?

I want to display a UITableView within the cell of another UITableView without using custom cell.
I tried to display it using a customCell, it is working but that is not convenient for me. So I would like to present the UITableView within a cell of other UITableView without using customCell
Can anyone tell me how to do this?
Many thanks in advance.
You should use a custom cell for this kind of thing. I don't think there is a way to implement it without a UITableViewCell subclass.
Look at this tutorial for some inspiration:
How To Make An Interface with Horizontal Tables Like The Pulse News App

NSTableView group row text field selection

I want to make a custom text selection in my table view.
I found this awesome answer on how to set the colors, fonts, etc. of the cells.
However, there is one issue.
It does not work for group rows. I see that the method gets invoked, but I think the style gets overwritten somewhere in either the NSTableCellView, or in the NSTableView class.
How can I fix this?
EDIT
It's a view based NSTableView

UITableView: how to make it not recycle cell?

Is there a way to make table view not recycle UITableViewCell so after all cells are loaded, it won't ask for cells(ie tableView:cellForRow...)?
I know I can put the table view in a scroll view and make the table view to have the same size as the scroll view, so all cells will be loaded, but some of my cells have variable sizes, then I need to update the scroll view's content size after the cells' sizes are changed.
Is there any other way to do this?
update:
Sorry for the misleading, actually I mean how to make it not REMOVE cells once created, so if there are ten cells, and there won't be any cell returned by dequeueReusableCell and after ten tableView:cellForRow: it won't call it again.
Simply not use reusable identifier will make it create new cell every time as needed, even the cell at position 1 has been created but then reused for position 2.
Set the reuseIdentifier to nil.
This is much better than using a different identifier for each cell, as the table can now dispose unneeded cells quickly. If they have some identifier set, there's no way to tell if you will ever reuse them.
So you don't have to miss the reuse part completely, just for the cells you don't want to. If the new cell contains the same subviews (maybe just layout and configured differently) - it might still be better to reuse.
Just don't use a cellIdentifier, or use a different identifier for each cell.
just dont use - (id)dequeueReusableCellWithIdentifier:(NSString *)identifier
in the cellForRowAtIndexPath method and create a new cell everytime.
Other way is to give a different cell Identifier for each cell you create.
Now, If you can elaborate on why you dont want the tableview to recycle its cells (which is one of the powerful feature of tableview), may be you can find out other ways to achieve the same thing with reusing the cells..!!
Hope it helps..:)

Unload specific UITableViewCells

Is there a way to unload/release a UITableViewCell such that the containing UITableView calls cellForRowAtIndexPath: when it is needed again?
I understand that this is exactly what UITableView does by default, but only once the cells are outside the tableview frame. My custom view uses UITableView in such a way that its frame == content size.
If there is no way to unload specific cells, I'll have to think of a different approach.
The method [UITableView reloadRowsAtIndexPaths:withRowAnimation:] allows you to tell the table view to reload one or more cells. This will reload the specified cell(s) if they are on screen and presumably do nothing if they aren't currently on screen. Sounds like what you want though your question is not entirely clear to me.

what is the simplest way to have text show if a tableview section is empty?

Preferably without looking like a cell. I would like to display "tap edit in the upper right to add syllables"
Your best bet would probably be to implement the tableView:titleForFooterInSection: method in the class that implements UITableViewDataSource.
Adding a sub view to your tableView with the same bounds should do it.