Ios tabBar BACK按钮在tableView上不起作用

Ios tabBar BACK按钮在tableView上不起作用,ios,iphone,uitableview,uibutton,segue,Ios,Iphone,Uitableview,Uibutton,Segue,我开发了一款情节提要iPhone应用程序,我有一个问题无法解决。我在这里寻找答案,在谷歌上搜索,但仍然找不到补救办法,提前感谢您的帮助或答案 我有一个mainViewController,它可以连接到一个带有tableView和单个单元格的viewController。该表显示从阵列填充的产品列表,并导航到显示其他阵列图像的detailViewController。tableView和详图控制器工作正常。我的问题是productViewController上的“后退”按钮。当您第一次到达产品表时

我开发了一款情节提要iPhone应用程序,我有一个问题无法解决。我在这里寻找答案,在谷歌上搜索,但仍然找不到补救办法,提前感谢您的帮助或答案

我有一个mainViewController,它可以连接到一个带有tableView和单个单元格的viewController。该表显示从阵列填充的产品列表,并导航到显示其他阵列图像的detailViewController。tableView和详图控制器工作正常。我的问题是productViewController上的“后退”按钮。当您第一次到达产品表时,后退按钮会将您返回到mainViewController,导航到detailViewController后,后退按钮会将您返回到最后一个视图,而不是mainViewController。我尝试过使用segue、IBAction代码等。当我在故事板中连接segue时,它会使应用程序崩溃。我在同一个应用程序中的其他ViewController上使用了完全相同的segues,它们的性能与预期一致。问题只出现在这一个viewController上

#import "productViewController.h"
#import "detailViewController.h"
#import "MainViewController.h"

@interface productViewController ()

{
    int _selectedRowNum;
}

@property (strong, nonatomic)NSString *list;

@end


@implementation productViewController

@synthesize images;
@synthesize details;
@synthesize detailTableView;



- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
  }

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.


   self.productTableView.delegate = self;
   self.productTableView.dataSource = self;


   images = [[NSArray alloc]initWithObjects:
               @"flor-sil",
               @"flor-shield",
               @"flor-finish",
               @"flor-finish-lg",
               @"flor-guard",
               @"flor-color",
               @"pc-5614",
               @"rsg",
               @"flor-cure",
               @"flor-clean",  nil];

    details = [[NSArray alloc]initWithObjects:
                @"sil-detail",
                @"flor-shield-detail",
                @"finish-detail",
                @"finish_lg-detail",
                @"ex-detail",
                @"color-detail",
                @"pc-5614-detail",
                @"rsg-detail",
                @"flor-cure-detail",
                @"flor-clean-detail",   nil];

    }

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
这是同一viewController中的下一部分

#pragma mark - Table View Delegate 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return images.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:    (NSIndexPath *)indexPath

        {
            static NSString *cellIdentifier = @"BasicCell";
            UITableViewCell *myCell = [tableView  dequeueReusableCellWithIdentifier:cellIdentifier];


        long row = indexPath.row;

        myCell.imageView.image = [UIImage imageNamed: images[row]];


            return myCell;
        }



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

{
   _selectedRowNum = indexPath.row;

   [self performSegueWithIdentifier:@"detailSegue" sender:self];

}


-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender

  {

        detailViewController *detailVC = segue.destinationViewController;

        detailVC.imgName = details [_selectedRowNum];

        NSLog(@"Segue");
    }

- (IBAction)back:(id)sender {
    [self dismissViewControllerAnimated:YES completion:NULL];
}

@end
我试过的其他代码

-(IBAction) back: (id)sender {
[self.navigationController popToRootViewControllerAnimated:YES];
} 
在替换“self dismissViewController”时使用此代码没有任何作用。没有回应