How can create collapse tableviewcell & every row contain plus button in every row in tableview? - swift

I have tableview every row contain plus button must when press on button add below row can remove this row by button and more detail in below screenshot this image contain ui must to do in app

Related

Cocoa - Get element that had focus before an action

I have a Window with multiple NSTableView elements where I can select rows.
Now when I press a button an action is triggered and I need to do stuff depending on which element in which NSTableView was selected before the click.
How do I do this?
I can check using the selectedRowIndexes but this is set for all tableViews that has selected items and not only for the one that the user wants the action for. (the last one that was selected)

UItableView custom cell with a plus button on the left side (outside table view)

I want to add a plus button outside my table view cell (on the left side), but the button should get scrolled if I am scrolling the table. Does anyone has a solution for this??? Also, there are 8 different sections in my table. There is no need to show that plus button for the first 7 sections, but there is a plus button in the 8th section clicking on which will increase the number of sections by 1. (the catch here is that the plus button is NOT INSIDE THE CELL and there are different sections where we will not show the plus button, so no UNIFORMITY).
I belive that the best solution to this is to create a custom section header (or footer) view and put the button there. It will "look" like it's outside the table, but it will be inside the given view.
In your case, only inside the section header/footer of section 7.
That button will scrool along with the table, as the section header/footer will.
Or, alternatively, you could have an "empty" section 8 (with no rows, but with a header) and display the button there. If you want the button displayed, you should return the number of section as "8", if you want the button hidden, return section count as "7".

UITable View Insert Row - can I press the actual cell rather than the green plus?

My table view is set up such that pressing "edit" creates an insert row using UITableViewCellEditingStyleInsert. The cell reads "add new item" and has a green plus next to it.
When the user taps the green plus, a modal view controller pops up so they can add a new item. This is fine. But it only works if they press the green plus itself - not the "add new item" cell.
How can I make it so that pressing the cell itself will do the same as the green plus?
Thanks!
You can; you just have to handle the selection yourself. First set allowsSelectionDuringEditing = YES, as shown above, then in the delegate's didSelectRowAtIndexPath: method, check to see if the selected row is the last row (or whatever row has your plus icon). If it is, run the same code you do in the didCommitEditingStyle: method.
I think ,Not possible because the entire edit mode process of UITableView is controlled by iOS (done by private API's) not exposed to us. we do have delegated (UITableViewDelegate) functions but not sufficient to get your work done.
Although, we can show the selection on the table Cell while in edit mode.
#property(nonatomic) BOOL allowsSelectionDuringEditing
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableView_Class/Reference/Reference.html

UITableView MoveRow Button position changing from right to left

I am developing one Arabic application in which I want a UITableview has right to left allurement for all the control , row delete button, row insertion button , row move button all should be align right left.
For this you can create a custom cell and do whatever you want. Follow this link text

Row selection when dragging over a UITableView with scrolling disabled

If one were to create a standard grouped table view consisting of two rows and then touch down on the first row, the cell would highlight. If one were to then drag one's finger down, the selection of the row cancels, and the table view begins to move with the drag.
Imagine the same situation, but with table view scrolling disabled via tableView.scrollEnabled = NO. Now, when one has selected a row and begins to drag, the row deselects and the table remains static.
I have two questions:
How can I ensure the row isn't deselected when one selects and drags within the confines of the row?
When one drags from the first row to the second row, how can I ensure that the first row is deselected and the second row becomes selected?
For an example of this functionality in action, open the Clock app and select the Alarm tab bar item. Tap the top right plus button and a modal view will appear presenting four rows. Tap down on the first row, drag onto the second, and you'll see the selection move across rows while the table itself remains static. How is this achieved?
On a tableView with scrollEnabled = NO when you touch on any cell you get a didHighlightRowAtIndexPath, and when you start to drag you get didUnhighlightRowAtIndexPath (even if you stay within the cell). The cell is not selected or deselected when you drag, and no further cells highlight/unhighlight on that touch.
There is a shouldHighlighRowAtIndexPath method that is called, where you can decide if the touch should highlight the row or not, but not a shouldUnhighlight method.
If the 'flash' of the highlight/unhighlight bothers you, you could use the shouldHighlight method to just return NO. Or you could return NO if a cell is selected.