0
我在UISearchBarDelegate
協議方法textDidChange
中沒有執行的方法cancelPreviousPerformRequestsWithTarget
有問題。iOS「cancelPreviousPerformRequestsWithTarget」在搜索字段委託方法中不起作用
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
SEL updateSelector = @selector(updateTableViewWithSearchPhrase:);
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:updateSelector object:searchText];
[self performSelector:updateSelector withObject:searchText afterDelay:0.5f];
}
我連續5次點擊一個鍵盤按鈕連續5次,並且該方法連續調用5次。問題在哪裏,嗯?