Я не могу загрузить вид из дополнительной вкладки (UITabbar) - PullRequest
0 голосов
/ 08 апреля 2010

Посмотрите на это видео, я все объясняю в нем: видео

Большое спасибо, надеюсь, вы мне поможете!


Спасибо за ваш очень быстрый ответ, так что каждая из моих "вкладок" использует "UITableViewController", код для всех одинаков:

- (void)viewDidLoad {
    [super viewDidLoad];

    self.title = [NSString stringWithFormat:@"S.I."];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Verin", @"Binaire - Héxa - Décimal",@"Transistors",@"PFS", nil];
    //Futures Categ
    //@"Conversions", 

    self.siArray = [array sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
    [array release];
}



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


#pragma mark Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.siArray count];
}


// 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:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Set up the cell...
    NSUInteger row = [indexPath row];
    cell.text = [siArray objectAtIndex:row];

    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
    // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
    // [self.navigationController pushViewController:anotherViewController];
    // [anotherViewController release];
    NSInteger row = [indexPath row];

    if ([siArray objectAtIndex:row] == @"Verin") {//Si on clique sur Polynomes

        SiVerinViewController *verin = [[SiVerinViewController alloc] initWithNibName:@"SiVerinView" bundle:nil];
        self.siVerinViewController = verin;
        [verin release];

        siVerinViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
        GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
        [delegate.siNavController pushViewController:siVerinViewController animated:YES];

    }

    //I use one:
    //if ([siArray objectAtIndex:row] == @"theCateg")
    //for each Table category

    if ([siArray objectAtIndex:row] == @"Transistors") {//Si on clique sur Polynomes

        SiTransistorsViewController *tempo = [[SiTransistorsViewController alloc] initWithNibName:@"SiTransistorsView" bundle:nil];
        self.siTransistorsViewController = tempo;
        [tempo release];

        siTransistorsViewController.title = [NSString stringWithFormat:@"%@", [siArray objectAtIndex:row]];
        GrugeAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
        [delegate.siNavController pushViewController:siTransistorsViewController animated:YES];

    }
}

1 Ответ

0 голосов
/ 08 апреля 2010

Проблема должна быть в вашем – tableView:willSelectRowAtIndexPath: делегата tableview для таблицы второго уровня. Вы не можете поместить подробный вид в стек контроллера навигации.

Контроллер панели вкладок использует другой код, и он работает правильно.

Я не могу рассказать тебе больше, не увидев код.

...