2012-05-12 66 views

Odpowiedz

53

Możesz zadzwonić pod numer [self.tableview reloadData]; i odświeżyć całą tabelę.

W przeciwnym razie można to zrobić, aby odświeżyć pojedynczą komórkę.

[self.tableView beginUpdates]; 
[self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPathOfYourCell] withRowAnimation:UITableViewRowAnimationNone]; 
[self.tableView endUpdates]; 
+0

Próbowałem [self.tableview reloadData] oprócz tego, że nie wydaje się, aby przypomnieć metodę „- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath "i dodaj obraz do nowych komórek. – user1120008

+0

To robi. Masz błąd w swoim kodzie gdzieś indziej. –

+2

Umieść NSLog (@ "Metoda nazwana"); w twoim '- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath' jeśli chcesz udowodnić to samemu. –

3

Skoro masz już indexPath komórki, czasem może to po prostu wykonać zadanie

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; 
[cell reloadInputViews]; 
+1

Jeśli używasz tylko UITableViewCell, a nie niestandardowej klasy, nie powinno być potrzeby rzutowania wskaźnika UITableViewCell na wskaźnik UITableViewCell – jcpennypincher

+0

@jcpennypincher dziękuję za wskazanie tego – user1139921

Powiązane problemy