UITableView Edit Indentation

I am creating a fairly simple UITable in my application with custom cells that I created. The target language is Hebrew. that is why all my tables are from right to left. Everything works fine until I change the table to edit mode. I successfully canceled the deletion and red accessory button because they are in the opposite direction, but the cell gets this tiny indent on the right, and part of my cell is not displayed.

I tried returning NO; to function

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath (NSIndexPath *)indexPath 

but it didn’t work.

any suggestions? thank you in advance

+4
source share
1 answer

I just tried this, and your function header looks right (at least for English / left right). I added a colon between "shouldIndentWhileEditingRowAtIndexPath" and "(NSIndexPath *) indexPath" - see snippet below.

 // Override to prevent indentation of cells in editing mode (in theory) - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath { return NO; } 

I also used the code below to stop the insert / delete functionality and enable line moving (easy to disable).

 // Select the editing style of each cell - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { // Do not allow inserts / deletes return UITableViewCellEditingStyleNone; } // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } 

Hope this helps.

+7
source

Source: https://habr.com/ru/post/1333042/


All Articles