ios 怎么让导航栏的返回按钮直接返回到根界面

2025-04-06 08:55:38
推荐回答(1个)
回答1:

self.navigationItem.hidesBackButton = YES;//可以隐藏原有的导航栏返回按钮

//设置的按钮会显示在导航栏左边,返回按钮的位置
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(buttonOF:)];
self.navigationItem.leftBarButtonItem = barButtonItem;