Od czasu aktualizacji nowego systemu iOS 11 mam aplikację, która pokaże puste wiersze widoku tabeli na symulatorze i urządzeniu. Nawet separatory rzędów nie będą wyświetlane dla żadnego z wierszy, które powinny tam być. Jeśli zmienię symulator na starszą wersję systemu iOS, wiersze będą wyświetlane poprawnie. Brak zmian w kodzie ani w scenorysie.Xcode 9 - iOS 11 Wiersze UITableView są puste
Wiersze nadal zawierają dane, co oznacza, że mogę dotknąć jednego z pustych wierszy, a następnie wykona kod i zawiera informacje, których się spodziewałem.
Wygląda na to, że inne sceny, które mam, gdy widok tabeli jest umieszczony w widoku i nie używam wbudowanej etykiety tekstowej, działają poprawnie. Tylko ta klasa widoku tabeli za pomocą wbudowanej etykiety tekstowej.
Oto mój kod dla klasy Tableview ...
@interface BunkPickTableViewController()
@end
@implementation BunkPickTableViewController
@synthesize appDelegate, delegate, bunkPassedValue;
- (void)viewDidLoad {
[super viewDidLoad];
UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.bounds];
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
CAGradientLayer *bgLayer = [BackgroundLayer tanGradient];
bgLayer.frame = self.view.bounds;
[self.view.layer insertSublayer:bgLayer atIndex:0];
self.tableView.backgroundView = backgroundView;
[self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
self.title = @"Bunk Codes";
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[self navigationController] setNavigationBarHidden:NO animated:NO];
[self.tableView reloadData];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [appDelegate.bunkArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.backgroundColor = [UIColor clearColor];
}
Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row];
cell.textLabel.text = bunkObj.bunkId;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row];
[delegate dismissBunkPop:bunkObj.bunkId];
[self.navigationController popViewControllerAnimated:YES];
}
@end
Kiedy przejdziesz przez kod, czy 'cell.textLabel.text' uzyska poprawną wartość? – Koen
To działa, a ja zepsułem i sprawdziłem, czy poprawna liczba wierszy pobiera prawidłowe informacje. Wszystko wygląda dobrze. – Kryckter
Mam podobny problem w projekcie, który doskonale działa na ios10 (wszystkie komórki są teraz puste. Tylko tytuły grupowe są normalne). Patrzę na to. – ZDidier