Управляемый кодом UITableView не делегирует - PullRequest
0 голосов
/ 21 марта 2011

У меня есть UITableView, который я добавляю динамически через initWithFrame.

- (void)twitterUpdate {
twitterTable = [[UITableView alloc] initWithFrame:CGRectMake(40, 100, 420, 750)];
twitterTable.delegate = self;
twitterTable.backgroundColor = [UIColor clearColor];
twitterTable.separatorColor = [UIColor darkGrayColor];
twitterTable.dataSource = self;
[twitterView addSubview:twitterTable];
}

К сожалению,

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

не вызывается, хотя у меня

<UITableViewDataSource, UITableViewDelegate>

определено в моем заголовке.

Есть идеи, почему это не называется? TwitterUpdate вызывается через

[self performSelectorOnMainThread:@selector(twitterUpdate) withObject:self waitUntilDone:YES];

и рисует таблицу на странице. У меня также есть

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 

возвращает действительный NSInteger.

Разве вы не можете динамически создавать подобные таблицы?

1 Ответ

3 голосов
/ 21 марта 2011

Обязательно позвоните:

[twitterTable reloadData];
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...