我在故事板内的表视图控制器中嵌入了导航控制器:
embedded

已为Table View Controller分配了一个继承自UITableViewController的自定义类(在身份检查器中):

@interface TableClass : UITableViewController

我想要实现的是从UINavigationBarDelegate获取事件,特别是这个事件:

- (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item;

显然继承协议是行不通的,因为TableClass继承自UITableViewController和 not UINavigationController .

为了从UINavigationBarDelegate获取事件,我该怎么办?

谢谢 .

EDIT - Different solution:

由于框架自动创建“后退”按钮,我决定自己创建按钮:

- (void)viewDidLoad {
[super viewDidLoad];

if ([[[someClass instance] stack] count] > 0) {
    NSString *titleBackName = [NSString stringWithFormat:@"%@", [[someClass instance] peakFromStack]];
    UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:titleBackName style:UIBarButtonItemStyleBordered target:self action:@selector(back:)];
    self.navigationItem.leftBarButtonItem=newBackButton;
   }
}

这意味着我在导航栏中分配了一个新的后退按钮,当用户点击它时,它将执行以下方法:

-(void)back:(UIBarButtonItem *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

这基本上意味着我现在通过我自己实现pop和添加到导航视图控制器的堆栈

Still looking 代表解决方案..