I have collectionview grid, Now I want to add a UIView on collectionview across full view as show in attached image with yellow color. Blue color column is fixed. I have to drag drop that strip view to in any row. Please, let me know approach.
You don't add views to existing cells. That's not how collection views work. You should tell the collection view to reload the cells in question. You can reload the entire collection view, certain sections, or individual cells (by indexPath)
What you show is a background color, not an image. I suggest changing the background color of the cells that you want to appear yellow rather than adding a new view to those cells. Just remember that your cellForItemAtIndexPath data source method will need to set the background color of EVERY cell, not just those cells that you want to be yellow or cyan (blue as you call it, but that color is cyan, not blue).
Related
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.
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.
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.
I've got a custom table view cell defined within a nib, I'm finding that whatever colour I set for view background in IB isn't being applied (why its not being applied is another question I have). So within the table view controller I added:
[localCell.contentView setBackgroundColor:LIGHT_BACKGROUND];
The cell colour now comes out as expected, however if in IB I set the accessory to anything other than none then the colour of the cell is shifted to the left by an amount about equal to the size of the indicator, behind the indicator I can see the background colour for the table.
Why is this happening?
TIA
The accessory view is not contained within the content view. You probably need to set the color of the background view of your cell rather than the content view.
[localCell.backgroundView setBackgroundColor:LIGHT_BACKGROUND];
I have a particular goal in mind here, searching for it is a little hard. I am trying to accomplish this (This is a photoshopped screenshot):
I have everything in this view working, except for the split row for the Company Name/ Beginning of the field row. The "Company Name" field is just a textfield, all I really want to do is shrink that neato cell background to just go behind the right side.
Create a custom table view cell that has two subviews: the text field on the left and a UITableViewCell on the right as a subview of the main table view cell. A UITableViewCell is just a UIView so you can actually add it as a subview of any view. The main table view cell will have it's background color set to transparent.
So totally complicated custom cell comes with a totally ridiculous solution. I built a view for the cell that has the one field...and another UITableView.
That second UITableView has the "Beginning of the field" text, and its cell gets the background, and I hide the background of the main cell.
I had to play around with the nested table's size and position to get the row to display properly, and make sure that the lines in the background don't shift when it hits the nested table, but it came out perfect
You could try setting the frame property of your cells backgroundView to cover only have your cell's width. Address Book handles complex forms like this with a nice look and feel--you might want to see what they've done there..
One approach would be to define a custom table view cell, set its background transparent and add the UITextField on the left and a UIButton on the right (customize it to look like your other cells), as in your screenshot.