2017-11-03 15 views
-4

文字列があり、ボタンのタイトルとして文字列を使用して、テーブルビューでセルを動的に追加したいと思います。テーブルビューにボタンとダイナミックテキストを含むセルを追加する

[self.array addObject:@"string"]; 
[self.tableView beginUpdates]; 
NSArray *arr = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:self.array.count-1 inSection:0]]; 
[self.tableView insertRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationAutomatic]; 
[self.tableView endUpdates]; 

をしかし、それは何もしません:

私はこのコードを発見しました。

答えて

0

基本的には、この作業を行う必要があります。しかし前にこれをすることを忘れていたかもしれません:

self.tableView.dataSource = self; 
関連する問題