У меня есть представление таблицы и настраиваемая ячейка, которые загружаются и настраиваются, но проблема в том, что данные не загружаются, если я не поворачиваю устройство. В портретном режиме, когда я впервые запускаю его, там ничего нет, как только я вращаю устройство в любом случае, все данные загружаются и работают отлично. Какие-либо предложения?iOS table view только загружает данные на вращение устройства
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"CellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"Hello"; return cell;
}
Загрузка данных -
PFQuery *query = [PFQuery queryWithClassName:@"Post"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
NSLog(@"%@", objects);
_postsArray = [[NSArray alloc] initWithArray:objects];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"There was an error loading the posts. Please try again" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}
}];
[self.tableView reloadData];