在UIViewController
viewDidLoad
方法中,我以这种方式自定义导航左键的图标和行为:
let backButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.action, target:self, action:#selector(handleBack))
self.navigationItem.leftBarButtonItem = backButton
有没有办法恢复原来的外表和行为?
答案 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)