searchBarSearchButtonClicked没有被调用

除了searchBarSearchButtonClicked之外别的代理都走 就searchBarSearchButtonClicked不走
因为是二手代码 查了后发现
有个分类

import "UIViewController+Search.h"

对全局都有影响

- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if ([text isEqualToString:@"\n"]) {
        [searchBar resignFirstResponder];
        if ([self conformsToProtocol:@protocol(EMSearchControllerDelegate)]
            && [self respondsToSelector:@selector(searchBarSearchButtonClicked:)]) {
            [self performSelector:@selector(searchBarSearchButtonClicked:)
                       withObject:searchBar];
        }
        return NO;
    }
    
    return YES;
}

键盘上的return 搜索就是\n 结果被多重拦截掉了 手动调用的又不符合需求.
有类似问题可对 分类集成重点搜索

你可能感兴趣的:(searchBarSearchButtonClicked没有被调用)