How to change/set/manage borders between sections in uicollectionview? - ios

I'm trying to build application with typical DataGrid inside. I have already built customCollectionViewLayout which displays data in DataGrid as you can see in attached picture (application screen). Every row is a section in CollectionView. I've added border (1.0f) to every cell, but I can't manage border size between sections - it also needs to be 1.0f, but now the border width is duplicated, because items are in different sections.
Could you please help me and advice how to set border between sections also equal to 1.0f?

Just Use the predefined delegate methods definitely it willIf work.
Still if you are facing problem in adjusting the border between the cell, design the custom cell like bellow picture.
It will creates the space between the cells automatically then you can design the cell border as per your requirement.

Related

How to draw corners and shadows on sections in a UICollectionView?

I want to create sections with shadows and a corner radius using a UICollectionView like shown below:
Is there an API available with UICollectionView to manipulate a section directly instead of manipulating the cells?
AFAIK nearly all answers on stackoverflow are based on tracking the indexPath and setting the cell.layer.cornerRadius accordingly (e.g. the top cell will render a radius and the bottom one will).
I'm looking for an approach where this is done outside the cell, perhaps using the UICollectionViewLayout although I'm not sure which API would make this possible.
As far as I know there is no such API, I would recommend you to use multiple tableViews (which are easy to modify according to your wishes) instead of one tableView divided in sections.
Your collectionView can contain cell that contains tableView. Your number of items on the collectionView will be the number of sections. Then the collectionViewCell will have a View with rounded corner and shadow and inside the tableView

UICollectionViewCell Shadow on all four sides

I was wondering want the best way to add drop shadows to a set of collectionviewcells that do not have spaces between them?
Background
Part of my layout has various cells positioned across the screen like a post. It notes and the second half of the layout is structured to look like a tableview except all the cells don't go to the edges there's a bit of padding. So I can't really add a shadow around the collection view itself.
I have added shadows to the cells in the post. It note part which works great because the cells have spaces between them but I'm now struggling with the second half (the tableview looking part) because obviously when you add the shadows to the cells depending on the zIndex you may see the shadow overlapping the below or top cell.
So I was wondering what is the best way to do this?
Should the shadows decoration views underneath the cells?
OR
Should the shadows be attached to the cell and increase the ZIndex for each cell so they appear on different levels hiding the shadow - but that leads to a question on how to do the first cell and have a top shadow?
OR
Should I almost fake it by using an image of a shadow inside the cell itself?
I also have deletion functionality so I need to figure out how to make sure if I delete the first cell, the second cell should then have the top shadow in a nice animated way.
EDIT:
I am trying to create the following view inside the collection view. I have got the layout correct. 1
The green lines are the shadows I have working but the red are the ones I'm having trouble with and the boxes are the different cells.

UITableView fixed section with dynamic size

I am trying to implement something like this:
I have a UITableView with 1. "static" section, the total number of sections in the tableView can vary. I always want the first section (white area) to be visible to the user, the remaining sections should scroll underneath the first section. I have tried to implement this with two UITableViews, but since the (white area) can vary in size, I can't set a definite frame. I am using Storyboards with autolayout. At the moment the best solution I have come up with is the two UITableViews, but I need to find a way that I can resize the two tableViews according to the content of the white area and according to each other. The white area, one of the tableViews is containing a section with two rows, the first row is containing text that can vary in length and therefore needs dynamic resizing.
Any Idea how I can tackle this? Can I change the NSLayoutConstraints dynamically somehow?
If i understand correct, your first UIView rectangle if fixed, bottom table is scrollable.
To implement this, you should create typical UIViewController, add UIView and UITableView (programmatically or through an outlets). You should manage each view (tableView and UIView) separately.

Need assistance regarding custom UITableView and custom UITableViewCell

This is screenshot of whatsapp, I have to create a tableview just like this one.
It has space on left side (Dont know top two cell are custom or default with right detail style).
Few cells in between have no separators.
How I am suppose to do same with my uitableview.
Start from iOS 7 left inset of UITalbeViewCell is default. Default value is 15, but you can change it.
This is not a few cells. This is One custom cell. I mean work+main+iPhone it is one cell.

Changing frame of one of two sections of UICollectionView - ios

I am trying to configure my CollectionView to have one section be differently sized than the others. I have two sections. Lower part should show a number of cells simultaneously and the upper section should only show one cell at a time but be scrollable to reveal more cells one by one.
I tried to play with the .frame property of the CollectionView but obviously it is not the right approach as it changes the appearance of the whole view.
I also tried to retrieve the FlowLayout object and see if I can get it from there. Did not find a way.
Neither the section Insets are the answer so far ...
It is simple to use two uicollectionviews for upper and lower section, instead of using only one.

Resources