Closed CainLuo closed 6 years ago
try this
+ (instancetype)searchViewControllerWithHotSearches:(NSArray<NSString *> *)hotSearches searchBarPlaceholder:(NSString *)placeholder
{
PYSearchViewController *searchVC = [[PYSearchViewController alloc] init];
searchVC.hotSearches = hotSearches;
searchVC.searchBar.placeholder = placeholder;
return searchVC;
}
⬇️
+ (instancetype)searchViewControllerWithHotSearches:(NSArray<NSString *> *)hotSearches searchBarPlaceholder:(NSString *)placeholder
{
PYSearchViewController *searchVC = [[self alloc] init];
searchVC.hotSearches = hotSearches;
searchVC.searchBar.placeholder = placeholder;
return searchVC;
}
@CainLuo @fakerlogic 确实是我的问题,这里应该是使用self
进行创建!才能走继承类的方法!
有一个场景我继承了一个PYSearchViewController在内部微调, 但是发现这个继承自的Controller不走
- (void)viewWillAppear:(BOOL)animated, - (void)viewWillDisappear:(BOOL)animated,
这些方法