У меня есть UIViewController, который имеет UISegmentedControl, который отображает 3 других представления в зависимости от того, какой сегмент выбран с помощью:
- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index
{
if (index == 0)
{
MyTableViewController *myViewController = [[MyTableViewController alloc] initWithNibName:@"MyTableViewController" bundle:nil];
myViewController.view.frame = CGRectMake(0.,40.,self.view.frame.size.width,self.view.frame.size.height-40.);
self.theTableViewController = myViewController;
[myViewController release];
[self.view addSubview: self.theTableViewController.view];
}
Но когда я выбираю строку из ячейки в этом представлении, он не нажимает наследующий.Это потому, что я вручную добавил это представление контроллера представления в иерархию представления, чтобы он не управлялся navcontroller.Я думаю, что мне нужно сделать собственность или что-то, в чём кто-то может вмешаться?
Редактировать:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SpecificExerciseTableViewController *specificExerciseTableViewController = [[SpecificExerciseTableViewController alloc] initWithNibName:@"SpecificExerciseTableViewController" bundle:nil];
specificExerciseTableViewController.exerciseArray = [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"exercises"];
specificExerciseTableViewController.muscleName = [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"muscleName"];
NSString *muscleURL = [[self.muscleArray objectAtIndex:indexPath.row]objectForKey:@"musclePicture"];
specificExerciseTableViewController.muscleURL = muscleURL;
[self.navigationController pushViewController:specificExerciseTableViewController animated:YES];
[specificExerciseTableViewController release];
}