我已经为首页创建了这样的按钮:

UIBarButtonItem * addButton=[[UIBarButtonItem alloc] initWithTitle:@"Home" style:UIBarButtonItemStyleBordered target:self action:@selector(GoToHome:)];
    [navItem setLeftBarButtonItem:addButton];

GoToHome函数只有一行,即:
[self.navigationController popToRootViewControllerAnimated:YES];

但是当我单击“主页”按钮时,它没有显示任何操作(无效)

最佳答案

在您的GoToHome方法中尝试

 [self.parentViewController.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];

关于iphone - 返回主屏幕,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8413080/

10-10 21:08