iPhone:导航栏按钮无限期地链接到它自己的视图

时间:2010-05-02 10:18:51

标签: iphone objective-c sdk uinavigationbar

当我从根视图导航到另一个视图时,它可以正常工作。但是,当我想要返回时,导航按钮会链接到自身。这持续大约6次点击,直到它最终回到根视图。

这只发生在一个视图上,其余视图正常工作。

我不知道是什么代码造成这种情况,但是如果你需要任何代码,我会用它修改这篇文章。请问它。

非常感谢, 插孔。

推送视图(在rootviewcontroller.m中)

在didSelectRowAtIndexPath方法

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    //CSS
    if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"CSS"])
    {
        CSSViewController *css = [[CSSViewController alloc] initWithNibName:@"CSSViewController" bundle:nil];
        [css setTitle:@"CSS"];
        [self.navigationController pushViewController:css animated:YES];
    }

    //HTML
    if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"HTML"])
    {
        HTMLViewController *html = [[HTMLViewController alloc] initWithNibName:@"HTMLViewController" bundle:nil];
        [html setTitle:@"HTML"];
        [self.navigationController pushViewController:html animated:YES];
    }


    //Apache
    if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"Apache"])
    {
        ApacheViewController *apache = [[ApacheViewController alloc] initWithNibName:@"ApacheViewController" bundle:nil];
        [apache setTitle:@"Apache"];
        [self.navigationController pushViewController:apache animated:YES];
    }

    //JS
    if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"JavaScript"])
    {
        JSViewController *js = [[JSViewController alloc] initWithNibName:@"JSViewController" bundle:nil];
        [js setTitle:@"JavaScript"];
        [self.navigationController pushViewController:js animated:YES];
    }

    //PHP
    if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"PHP"])
    {
        PHPViewController *php = [[PHPViewController alloc] initWithNibName:@"PHPViewController" bundle:nil];
        [php setTitle:@"PHP"];
        [self.navigationController pushViewController:php animated:YES];
    }

    //SQL
    if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"SQL"])
    {
        SQLViewController *sql = [[SQLViewController alloc] initWithNibName:@"SQLViewController" bundle:nil];
        [sql setTitle:@"SQL"];
        [self.navigationController pushViewController:sql animated:YES];
    }

    //HTML Colour Codes
    if ([[arryResources objectAtIndex:indexPath.row] isEqual:@"HTMLColourCodes"])
    {
        HTMLColourViewController *htmlcol = [[HTMLColourViewController alloc] initWithNibName:@"HTMLColourViewController" bundle:nil];
        [htmlcol setTitle:@"Colours"];
        [self.navigationController pushViewController:htmlcol animated:YES];
    }

    //Useful Resources
    if ([[arryResources objectAtIndex:indexPath.row] isEqual:@"Useful Resources"])
    {
        UsefulViewController *useful = [[UsefulViewController alloc] initWithNibName:@"UsefulViewController" bundle:nil];
        [useful setTitle:@"Resources"];
        [self.navigationController pushViewController:useful animated:YES];
    }

    //About
    if ([[arryResources objectAtIndex:indexPath.row] isEqual:@"About"])
    {
        AboutViewController *about = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil];
        [about setTitle:@"About"];
        [self.navigationController pushViewController:about animated:YES];
    }

0 个答案:

没有答案