edit Textfield with a little delay - swift

I working with swift 4 for macOS and have a NSTableView with custom Cells.
In my row are two textfields (style: borderless and no background color)
Normally, you click on a textfield and it will directly be editable.
In my case, you click on the textfield and after a short delay it will be editable.
But I don't understand why is there such a delay.
Have anybody an idea?
Better Example
My tableview with Custom Cell View (delay problem)
Another tableview without Custom Cell View (no delay problem)
I hope you can see the difference. I do both situations with the same steps.
Select Row (click)
Select textfield (click)

Seems like you’re selecting the table view cell first. Try tableView.allowsSelection = false

Related

disable tableview with all elements

I working with swift 4 for macOS and I have a NSButton, which should disable my NSTableView with all elements (textfields, buttons, ...)
In the IBAction of my button I have this code lines:
myTableView.deselectAll(nil)
myTableView.isEnabled = false
This works good, but I found a little "bug".
If I select a textfield of my tableview (edit mode on)
and press after that my button, the tableview will be disabled and all selected rows will unselect, but I can edit the content of my textfield without a problem, because the "edit mode" is still on.
Must I disable all my textfields in the tableview manually or is there an elegant trick?
You can make NSTextField lose responder with
view.window?.makeFirstResponder(view.window)
This should do the trick.

How to show custom options on swipe table cell in a simple way

I am working on a app which includes table cells. I want that when i swipe table cell it shows two options, first about that cell value and another for delete that value. How can i show that in a way that the cell value shows in half of cell and the options show in half of cell.
Thanks in advance.
There are an out of the box solution, called HHPanningTableViewCell. It does exactly what you need!
HHPanningTableViewCell is a UITableViewCell implementing "swipe to reveal" a drawer view. Such a view typically holds action buttons applying to the current row.
This library, SWTableViewCell, should help you:
https://github.com/CEWendel/SWTableViewCell
An easy-to-use UITableViewCell subclass that implements a swipeable content view which exposes utility buttons (similar to iOS 7 Mail Application)
You have to create a custom cell and override Apple's behavior which is swipe left to delete and then show your options. You can add gesture recognizer to the cell and on swipe to left animate the cell content view and animate in your option view or however you like it to be. I can write up an example code if you need.

Prevent keyboard from moving textview in UITableView

I have 2 cells in a group in a tableview, the first has a textview in it, (2 lines max). When the user selects the textview, the keyboard appears and moves the textview up from under the keyboard. the second cell only appears when the textview has focus.
However the second cell is still hidden by the keyboard, I have tried to the various methods that scroll the tableview, but the result is always jerky, with the table moving up and down rapidly. Probably because its inserting a row, scrolling up for the keyboard and me trying to make it scroll up even more all at once.
How can I prevent the keyboard from moving scrolling the table view at all, so that I can do the scrolling myself exactly how I want it, and avoid the ugly fight between the two methods.
Did you try this method by setting scroll position to UITableViewScrollPositionTop ,if this not work ,just make your second cell that with textfield :)
- (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
Use a UITableViewController instead a UIViewController (for the ViewController where your UITableView is placed). That will solve the scrolling issue.
If not possible, you have to scroll by your self (pain in the ass).
See: Making a UITableView scroll when text field is selected

Edit Cell Text in UITableView

In my app I have a set number of cells in a UITableView, 10, no more, no less, and the user can't change that.
However what I would like to have is so that if the user was to naturally in an iOS fashion, swipe a cell, or press an edit button, the cell text becomes editable with a simple tap on the cell bringing up a keyboard.
I was just wondering if there is a fairly simple method to do this, or take quite of custom building? What are you thoughts on how this could go together?
Thanks.
This should work if you just add a UITextField into the table cell's contentView I believe.

Scroll complete tableView while updating tableviewcell

I have just three custom tableViewCell rows in my tableView. First and second are with label while third is with TextView, i want to autoscroll complete tableView as i type in TextView (3rd row) cell and there is no visible typing space. Can anyone help me providing some guideline, how to achieve this?
When the text view delegate receives the didBeginEditing call, change the frame of the table view so that it's position is moved upwards. Wrap that up in a UIViewAnimations block and it'll scroll nicely.