恢复原始后退按钮行为

时间:2016-11-15 11:51:44

标签: ios swift3 navigationitem

UIViewController viewDidLoad方法中,我以这种方式自定义导航左键的图标和行为:

let backButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action, target:self, action:#selector(handleBack))
self.navigationItem.leftBarButtonItem = backButton

有没有办法恢复原来的外表和行为?

enter image description here

3 个答案:

答案 0 :(得分:0)

你必须这样做:

string paragraph; string sentence; for(auto p = 1; getline(fin, paragraph, '\n'); ++p) { istringstream sentences{ paragraph }; for(auto s = 1; getline(sentences, sentence, '.'); ++s) { istringstream words{ sentence }; auto i = 1; for_each(istream_iterator<string>(words), istream_iterator<string>(), [&](const auto& word){ cout << 'w' << i++ << ", p" << p << ", s" << s << (find(cbegin(strmatch), cend(strmatch), word) == cend(strmatch) ? ", word, " : ", namedEntity, ") << word << endl; }); } } 方法中,添加以下内容:

viewDidLoad

要还原,请执行以下操作:

self.navigationItem.hidesBackButton = YES;
let backButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action, target:self, action:#selector(handleBack))
self.navigationItem.leftBarButtonItem = backButton;

答案 1 :(得分:0)

self.navigationItem.leftBarButtonItem = nil
self.navigationItem.hidesBackButton = NO

答案 2 :(得分:0)

导航栏仅支持这些

buttons

我用this完成了提取iOS资产资产的问题,即使我使用了提取的内容,校准后退按钮看起来也不是很烦人,我的建议是让导航控制器通过保持来处理这个问题推到堆叠时出现的背面。