0
我使用的是tableview,我正在對uitableview進行多重檢查。一切都進行的完美,我',得到正確的值,但當我滾動表視圖時,它丟失了複選標記圖像(使用默認複選標記沒有自定義圖像),但選定的值保留在陣列中...滾動的tableview從uitableview單元格中移除checkmarrk
滾動表視圖刪除複選標記圖像。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
AppDelegate *app= (AppDelegate *)[[UIApplication sharedApplication]delegate];
if([_tableView cellForRowAtIndexPath:indexPath].accessoryType == UITableViewCellAccessoryCheckmark){
NSLog(@"yes");
[placesvisitedarray removeObject:[app.nameArray objectAtIndex:indexPath.row]];
[_tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryNone;
}
else
{
NSLog(@"no");
[_tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
[placesvisitedarray addObject:[app.nameArray objectAtIndex:indexPath.row]];
}
// [_tableView reloadData];
}
您能否爲此提供一個代碼 – 2013-02-10 11:42:20
我試過了,但它根本沒有奏效 – 2013-02-10 13:07:43