开发者

UITableView Edit Indentation

I'm building a pretty simple UITable in my app with custom cells that I'v created. The target language is hebrew. 开发者_JAVA技巧thats why all my tabels are right to left. Everything works fine until I'm changing the table to Edit mode. I'v successfully canceled the delete and the red accessory button becuase thay are in the oppisite direction but the cell get this tiny indentation to the right and part of my cell is not showed.

I tried the return NO; to the function

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

but it didn't work.

any suggestions ? thanks in advance


I just tried this and your function header appears to be correct (at least for English/left-to-right). I did add a colon between the "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 the rows can be moved (easily switched off).

// 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜