开发者

Uncheck every cell on tableView

Hey guys i have a UITableView that is using the UITableViewCellAcessoryCheckmark as a checklist on my app. I want one 开发者_StackOverflowbutton that will erase each cells checkmark, Does anyone know how i can go about this? thanks :D


You could uncheck all of them in your model (if you are using good MVC) then reload the table. [someTable reloadData];


First, when you build/init the tableView, in the delegate method, add the cells to an array. Then you can use a for loop to run through the array like so:

for (UITableViewCell *cell in cellsArray) {
    [cell setAccessoryType:UITableViewCellAccessoryNone];
}


still need it ? if so its go like this and its very very simple !

in your

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

add this method -

if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
    cell.accessoryType = UITableViewCellAccessoryNone;
}

and in your IBAction function just add-

[SomeTable reloadData];

this will clean all your checked celles.

Have fun !

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜