UITableViewCell Show editactions programmatically - ios

I am hoping there is a way to programmatically display the swipe left edittask list for a given cell. I tried everything I could think of to get it to display but nothing seems to work.
I am able to show them with a swipe left without issue but I need the ability to show them programmatically.
How to accomplish this?

Try setting editing on the cell. According to this from Apple, it should display the edit actions.

Related

Is it possible to change default delete action Icon in UITableView edit mode?

I would like to set custom icons for the UITableView delete icon for the table's edit mode.
I found a way of doing it by setting UITableViewCellEditingStyleNone in editingStyleForRowAtIndexPath method ant then adding my custom button view in the place where that icon should be by subclassing UITableViewCell. source (enter link description here)
I set up a delegate to get the tap even from that button, but with this approach when I tap on this custom button I can't get the cell to slide to the left to reveal red delete button (see the image). So this way, I can just delete the cell by taping only once.
What I need is to mimic the same standard deletion flow with two taps(first on the left delete icon, second on the delete button the slides to the left) but also have my custom icon for the delete on the right.
Is this possible to do?
Any kind of help is highly appreciated.
For fully customize UITableViewcell https://github.com/CEWendel/SWTableViewCell
It will Help you a lot

Automatically scroll UITableView to show row **below** the row being edited

I have UITableView in a ViewController (not a UITableViewController) with UITextFields in each row. I would like the TableView to automatically scroll so that the row below the row being edited is always displayed. This allows the user to tap the next row to edit it. The built in iOS Reminders app has this behaviour.
I have followed Apple's advice on managing the keyboard but that only scrolls to show the row you are editing just above the keyboard, not the row below it.
I have tried adjusting the frame in scrollRectToVisible: but it makes no difference. In fact commenting out that line of code seems to have no effect at all.
It seems that the UITableView will always try to scroll to show the UITextfield being edited just above the keyboard, and I can't find a way of adjusting or overriding this behaviour so that it shows the row below it also.
Update:
I've found that the automatic scrolling behaviour can be prevented by overriding the private scrollTextFieldToVisible method of UITextField.
However, the automatic scrolling code provided by Apple in the linked documentation still does not work.
You can try setting setContentOffset property instead of scrollRectToVisible. like
[self->_scrollView setContentOffset:CGPointMake(0, textFieldRect.origin.y)];
Please follow the below link, it will make your work very easy.
Just add the files and make the tableview class name as "TPKeyboardAvoidingTableView"
https://github.com/michaeltyson/TPKeyboardAvoiding

How to enable both swipe to delete and a delete button made in edit mode in UITableView

By default edit mode is on, that's why swipe on cell, it will delete like this, and when click on edit following method use to delete the data
Right now it works correctly but either one of them is going to use. I want to use both method for delete cell.
Please help me to find some code snippet or tutorial link
The natural iOS behaviour for Edit mode in a UITableView is just showing the '-' button for deletion, thats the way I recommend you to use, because of the users are use to deleting on that way.
With this library, you can assign custom buttons and actions for both Swipe directions. Maybe with it you can achieve what you want.
https://github.com/MortimerGoro/MGSwipeTableCell
I would try to add a custom right UIBarButton with a custom action, and after it get pressed, you can try to force swiping the cell to both directions, and showing the buttons you want.

UITableViewCell and the case of the missing Subtitle

I've checked all the usual suspects. I have a UITableView in an iOS 8 app that uses the UITableViewCellStyle.Subtitle and sets a subtitle for every cell. I won't bother including code as it's no different from any other code for this. The issue I'm having is best described as follows: my cells also have actions (the new API in iOS 8 lets you add actions to your cells accessible by swiping left on them, similar to Mail). Sometimes (seemingly random), however, the subtitles don't show up unless I swipe on them. Upon swiping, the subtitle appears. Scrolling the cell in and out of view again makes the subtitle disappear until I swipe on it once more. What could be causing this? The subtitle attribute is clearly being set on the cell, it just isn't visible when the cell becomes visible.
Additional info: when troubleshooting, I decided to disable the actions on the cell to see if that was the issue. However, the same problem would occur. Interestingly, with actions disabled, scrolling the cell out and back into view would cause the subtitle to appear.
I'm not unconvinced it's related to this: Subtitles of UITableViewCell won't update
You can chech my answer here for a temporary work around. Just put a blank space character in the interface builder inside the subtitle. check the answer for more details.

change order of list in tableview by clicking on whole cell

I currently have a 'tableview' with a list of items and I have enabled an 'edit' button to go into edit mode which shows the 'reordering controls' on the right side of the screen. I have also enabled 'canMoveRowAtIndexPath' and 'moveRowAtIndexPath:toIndexPath' to allow for the user to hold and drag the reorder control on the right side to reorder the list and have the data model update.
Is there a way to enable this but allow the user to click and drag the whole cell and not only the 'reorder controller'? Essentially I want to enlarge the area of the reorder controller's function to the whole cell when tableview is in editing mode.
for anyone else who is interested, I used this guide to get it working: b2cloud
the starting code template does not work as optimally since it has nib files and I'm using Xcode5 but it still works. The important code is all in the actualy tutorial as he lists how to set the reorder control to the size of the size via inserting it as a subview.
There is a way to enable this that allow the user to click and drag the whole cell and not only the 'reorder controller'!
Please check it out: https://github.com/FlorianMielke/FMMoveTableView
This might be helpful to you, Sir :)

Resources