Я настроил контроллер табличного представления и подключил вспомогательное представление, поэтому, когда я нажимаю на строки, появляется новое подпредставление. Я шаг за шагом следовал нескольким учебникам, но по какой-то причине, когда я нажимаю на строки, ничего не появляется (хотя строка выбирается).
Вот мой главный контроллер вида:
@interface TableViewsViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *tblSimpleTable;
IBOutlet UINavigationBar *navBar;
NSArray *arryData;
NSMutableArray *listOfItems;
}
@property (nonatomic, retain) IBOutlet UITableView *tblSimpleTable;
@property (nonatomic, retain) IBOutlet UINavigationBar *navBar;
@property (nonatomic, retain) NSArray *arryData;
@property (nonatomic, retain) NSMutableArray *listOfItems;
.m (соответствующие части)
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Computers"];
NSString *cellValue = [array objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) indexPath
{
NSDictionary *dictionary = [listOfItems objectAtIndex:indexPath.section];
NSArray *array = [dictionary objectForKey:@"Computers"];
NSString *selectedCountry = [array objectAtIndex:indexPath.row];
//Initialize the detail view controller and display it.
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
dvController.selectedComputer = selectedCountry;
[self.navigationController pushViewController:dvController animated:YES];
dvController = nil;
}
И контроллер подпредставления:
.h
@interface DetailViewController : UIViewController {
IBOutlet UILabel *lblText;
NSString *selectedComputer;
}
@property (nonatomic, retain) IBOutlet UILabel *lblText;
@property (nonatomic, retain) NSString *selectedComputer;
@end
.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
//Display the selected country.
lblText.text = selectedComputer;
//Set the title of the navigation bar
self.navigationItem.title = @"Selected Computer";
}
Я почти уверен, что в IB все хорошо связано.
Спасибо за любую помощь!