Я создал пользовательскую ячейку, в которой в настоящее время отображается изображение и текст, но не текст детали.UITableView detailTextLabel не работает с пользовательской ячейкой
Даже с "cell.detailTextLabel.text" он все равно не будет отображаться. Кто-нибудь может понять, что случилось?
Я попытался изменить UITableViewCellStyleSubtitle на UITableViewCellStyleDefault и другие.
Я искал этот сайт и Google в течение последних нескольких часов, исправляя ошибки, ни одна из них не работала.
Любая помощь будет оценена по достоинству.
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"myCell";
UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:nil ascending:YES selector:@selector(localizedCompare:)];
NSArray *sortedCategories = [self.tweetSongs.allKeys sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]];
NSString *categoryName = [sortedCategories objectAtIndex:indexPath.section];
NSArray *currentCategory = [self.tweetSongs objectForKey:categoryName];
NSDictionary *currentArtist = [currentCategory objectAtIndex:indexPath.row];
NSDictionary *currentSong = [currentCategory objectAtIndex:indexPath.row];
cell.textLabel.text = [currentSong objectForKey:@"Song"];
cell.detailTextLabel.text = [currentArtist objectForKey:@"Artist"];
cell.textLabel.textColor = [UIColor whiteColor];
cell.imageView.image = [UIImage imageNamed:[currentArtist objectForKey:@"Artwork"]]
}
Вот ссылка на скриншот клеток (я не позволен прикрепить изображение без повторения 10):
Спасибо за ответ, я просто попробовал, и он по-прежнему не создает detailTextLabel. textLabel центрируется в середине ячейки, похоже, что нет места для текста с субтитрами - проверьте снимок экрана, который я добавил – mhorgan