Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A Non editable UITableView section?

I have a UITableView with 3 sections. The top two sections are static, and the third can be manipulated by the user. By overriding the commitEditingStyle method, I can remove entries as needed from section 3. However, doing this makes the Delete button appear on the cells in sections 0 and 1, even though I only execute the code when the selected cell is in section 3.

I feel like it's confusing if the delete button can be brought up on sections 0 and 1 even though the code doesn't do anything. Is there any way to set sections 0 and 1 so that left->right swipes don't set those sections editable?

Thanks!

like image 830
Daddy Avatar asked Jan 27 '26 20:01

Daddy


1 Answers

Use - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath in the dataSource

like image 167
jamesmoschou Avatar answered Jan 29 '26 10:01

jamesmoschou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!