Alloc 没作用

我hook进了一个controller想要增加一个原先没有的左导航按钮,但均没有效果。目前可以修改已有的右导航按钮,但是alloc不了一个新的按钮对象。我反复查看仍找不到问题的所在。

谢谢大家帮忙。

  • (void)viewWillAppear:(BOOL)arg1{
    %orig;
    // this works
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@“Whitelist” style:UIBarButtonItemStylePlain target:self action:@selector(showWhiteList)];

    // this doesn’t work, left bar button is not initialised
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@“Whitelist” style:UIBarButtonItemStylePlain target:self action:@selector(showWhiteList)];
    }

不是 allocation 没有用是设置返回按钮的姿势不对,至于为什么不对,我也不知道,你自己研究吧