Prevent cell check mark inside UITableViewCell shifting labels - ios

I have a table view set up in a view controller. When the user selects a row, a check mark appears. When the deselect the user deselects the row the check mark disappears.
The cell is a custom cell with two labels inside of it. When a checkmark appears it shifts both labels left. How can I prevent this?
I am using autolayout/constraints and it is not an option not to use them.
Any ideas?

Related

Change individual cells in UITableView

Need your advice:
I need to change view of all cells, when one exact cell is selected.
Par example, I tap on the 5th cell and it changes the color of 4 previous cells
One of the cells can't be selected when the other ones are selected.
Par example, the 5th cell can't be selected when one (or some) of the previous ones is selected.
So add logic to your tableView(_:didSelectRowAt:) delegate method that tells the table view to reload the affected cells. (You'll need to reload both the 4 previous cells and the 4 cells prior to the previously selected cell.)
Then update your tableView(_:cellForRowAt:) method to set the color of cells based on the currently selected cell.

Limit the cell selection area in uitable view

I have a custom cell in table view, which allows multiple selection. Can i limit the cell selection area of a custom cell. Can i enable selection area to only the left side of the cell not the entire cell.
Please share your thoughts.
In your UITableViewCell subclass override pointInside:withEvent: method and return YES only for the points inside the area you want.
Yes, the way you want can be implemented, You make a button on left side of your cell. So Whenever you click on button your selected are will be enabled.
You do not need to implement any logic in UITableView DidSelectRowForIndexPath.
Need to manage in your button.
You can add a UIButton on the left side of your cell, by this way you can easily handle the selection of UIButton by using its tag value.
In the custom tableView Cell. The are which you want to be non clickable add a button to that area and if a tap is registered in the button the didselectitem at indexPath would not be called I have done a similar implementation myself.
My TableView Implementation

How to set button to scroll to next tableview row?

So each row has the same button and I want that button to scroll to the next row.
In tableView, you can set each button has different tags(button.tag). When you selected it, use tag to decide which row you will scroll to.

Edit on last cell of the TAble view

In my table view cell have textView.it is custom cell.
when i select one text view it move to top position of the tableview then i can edit.
[self.tableViewEdit setContentOffset:offset animated:YES];
this is the code i used for that.it work fine.
Last cell also move to top.but when i type in last cell it move to bottom of the last cell and move up again.
is there any way to remove last cell's bottom attraction with tableview.or how to fixed last cell top of the tableview.
when typing i used
[self.tableViewEdit beginUpdates];
[self.tableViewEdit endUpdates];
otherwise i cant keep keyboard when i typing.why i`m using above code i want to change cell height according to my typing.

how to add data separately in cell of tableview separately

I'm having three buttons on table view cell and have to show some text on label below it but when i'm clicking on button and selecting text it shows in all row and if second button clicks data of first label get blank so is their any way to fill data seprately to cell of table view
Yes it is you have to test for indexPath to see if that cell will display or not what you want. And keep in mind that cell are reused so you have also to remove content from cells or use different cell identifiers for each type of cell.

Resources