Custom swipe to delete for rounded TableViewCell with drop shadow - ios

I'm trying to make a custom swipe to delete style which appears like being behind the cell itself, not side by side like the default trailingSwipeActionsConfiguration.
Something like this:
Is there any way to create a design like this?
From what I've tried with the default swipe control there will be a gap between the cell itself and the delete button due to the cells padding for drop shadow and also the red color of the delete button needs to extends under rounded corners of the cell.
Also I've tried creating a subview behind the cell when tableview willBeginEditingRowAt is being called but it seems off(sometime works, sometimes doesn't). Perhaps there might be a proper way to achieve this?

Related

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.

UITableViewCell overlap shadow on top of cell directly below

I'm trying to create a simple effect where a cell casts a shadow on top of the cell directly below (in a vertical UITableView). Much like a tiled roof where the top tile is layered above the tile below and casts a shadow on the cell below.
I've tried overriding layoutSubviews in UITableView and played with bringSubviewToFront etc but that did not work. The shadow works somewhat but disappears as you tap on a cell (somehow the selected view overlaps it).
Any way to do this easily?
It seems the only reliable way is to draw the 'shadow' on the cell below the top one and then keep track of global selection states. A second option is to use UICollectionView instead but that's an overkill.
For cell dropping shadow on the one below:
Add shadow to the layer of a view in your cell.
For all cells dropping shadows only on the background view
Add shadow to the layer of the tableview itself.

UITableViewCell covering delete button on swipe left

I am posting this question, specifically related to iOS 7.
When I swipe cell to left, the delete button appear correctly, but the cell is not moving left enough, which results in the delete button being covered by the cell for nearly half of its width.
The cell is a class extending UITableViewCell, and in Storyboard there's a UIView with some child views in it, but for the rest it is just a plain cell.
The custom class is not implementing any drawing mechanism.
Unless you have some custom code configuring your cell, I would remove the code for this and add it back. There has to be something that you've written in your code to cause this to happen. Usually, this functionality works right out of the box. Post your code so that we can see what's causing the issue.

Making UITableView with delete buttons visible for all cells

Normally one can create a UITableView with cells that allow the user to reveal the red "Delete" button on the right side of the cell by swiping that cell or by tapping a knob visible on the left side of the cell.
However, I would like to create a UITableView which has all cells with visible "Delete" button by default (no swiping / tapping knob necessary). Is it possible to do utilizing the standard Cocoa Touch methods?
(I know I can define my own button in a custom UITableViewCell, but I'd rather use a standard method if possible...)
Call [tableView setEditing:YES animated:NO] in your view controller's -viewDidLoad implementation.
Well.. NO. Actually the red minus on the left side is the constant-visible solution in Cocoa. I don't believe you get the right delete button without ugly hacking of the tableView.
So probably you have to make a custom solution. But you need no subclassing here. You can just use a regular UITableViewCell and set a UIButton as the accessoryView.

Kind of complicated custom UITableViewCell

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.

Resources