UITableViewCell covering delete button on swipe left - ios

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.

Related

UICollectionView within UITableViewCell with Swipe

I am using Xcode 7.1 and Swift 2.1 version.
I am looking for something as shown in the picture
Here in the left screen (Before Swiping), I have a UITableView in which there are certain cells in which I have to implement a right swipe functionality.Now when I swipe right the one coming from right must be a UICollectionView as shown in right picture (After Swipe) as there can be many options (a,b,c,d,e....). So they should be in some scroll view like UICollectionView.I searched a lot and found some libraries like
https://github.com/MortimerGoro/MGSwipeTableCell
https://github.com/CEWendel/SWTableViewCell
They provide array of UIButton or a single Button with image or text. We can add multiple buttons but they will shrink accordingly.
I want something called a UIView in which I can place UICollectionView and make its datasource accordingly with fixed size cells as shown in the picture.Any source or link for the same is highly appreciable.
Thanks

Swipe to delete UITableViewCell very difficult to trigger

So I have a table view and I'd like the user to be able to swipe left to reveal a delete button, identically to how it works in the mail app. My issue is not that I can't get this to work - it does, I can swipe the row left, it reveals a delete button, and the user can click it to delete the cell (I do this by implementing editingStyleForRowAtIndexPath). My issue is that the swipe that is required is extremely insensitive. You have to swipe very fast and perfectly horizontally. It is not nearly as smooth as the swiping in mail. Is this just the way it is or am I overlooking something?
I thought maybe the views in the cell were blocking the swipe gesture somehow, but I went into the xib and set everything to hidden and it still is extremely difficult to swipe. The other thing I tried was to add my own swipe gesture recognizer to trigger the delete show. I tried adding it to the cell (that didn't work), to the table view (nope), and I also tried adding a clear colored UIView as a frontmost subview and putting it on that, but still no. Any ideas?
EDIT:
I just created a new project to test the responsiveness of the editing style delete feature - very very simple table view just to see how it works. It is MUCH easier to swipe than the cell in my actual project. There aren't many differences between my test project and my actual one: actual loads a xib on cellForRowAtIndexPath while in test project it uses default styled cell, actual project has imageviews and uilabels within cell while test project is just a uilabel... what could be making it so unresponsive?
It turns out there was a competing gesture recognizer hidden in a superclass I was completely oblivious to. Once I realized that, it was easily solved by disabling the other recognizer for that screen (although I believe there would be a more correct way of doing it by setting gesture recognizer priorities). Anyway, if you are having similar issues - really strange/ unexpected behavior from a UIGestureRecognizer - I would ensure there is no other gesture recognizer interfering.
You could try to "roll your own". In the built-in UITableView, we are probably responding to a leftward swipe gesture recognizer (the gesture for which, as you say, must be quick and very horizontal in order to recognized). The way this works in Mail, on the other hand, is that the cell contents actually contains a UIScrollView, capable of being scrolled horizontally only - and that is what you are doing when you slide left, just dragging as you would with any scroll view. (That's why you can peek at the Delete button and then drag the message back to the right.)

TableView editing mode deletion button overlaps

Currently I am working on an app where I have a UITableViewController and wan't to be able to delete the items. So I added the correct buttons and methods. However when I press the edit button the deletion icons appear over the my text.
With the default UITableViewCell this is not happening. Then the text moves so it clears free from the button. How could I achieve this in my own table view cell?
As stated by Putz1103 this happens when you place your views on the view instead of the contentView. The contentView is handled by iOS automatically.
With the answers provided here I continued my search. And this answer on this question is what I did wrong. I had a UIView (of which I changed it's class in the Interface Builder to a subclass of UITableViewCell.
But I had to drag out a UITableViewCell, and that one did have a contentView property.
Thanks for the responses.

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