diff --git a/PYSearch/PYSearchViewController.m b/PYSearch/PYSearchViewController.m index 4b0c1a2..98524ab 100644 --- a/PYSearch/PYSearchViewController.m +++ b/PYSearch/PYSearchViewController.m @@ -553,10 +553,13 @@ - (NSArray *)addAndLayoutTagsWithTagsContentView:(UIView *)contentView tagTexts: - (void)setSearchHistoriesCachePath:(NSString *)searchHistoriesCachePath { _searchHistoriesCachePath = [searchHistoriesCachePath copy]; - // 刷新 self.searchHistories = nil; - [self.baseSearchTableView reloadData]; + if (self.searchHistoryStyle == PYSearchHistoryStyleCell) { // 搜索历史为cell类型 + [self.baseSearchTableView reloadData]; + } else { // 搜索历史为标签类型 + [self setSearchHistoryStyle:self.searchHistoryStyle]; + } } - (void)setHotSearchTags:(NSArray *)hotSearchTags @@ -758,7 +761,7 @@ - (void)emptySearchHistoryDidClick // 移除所有历史搜索 [self.searchHistories removeAllObjects]; // 移除数据缓存 - [NSKeyedArchiver archiveRootObject:self.searchHistories toFile:PYSearchHistoriesPath]; + [NSKeyedArchiver archiveRootObject:self.searchHistories toFile:self.searchHistoriesCachePath]; if (self.searchHistoryStyle == PYSearchHistoryStyleCell) { // 刷新cell [self.baseSearchTableView reloadData];