0
searchBar:shouldChangeTextInRange:replacementText從未調用過。該代表被定義,方法 - searchBarShouldBeginEditing:和searchBarTextDidBeginEditing:工作正常,但shouldChangeTextInRange未被調用。我發現,當值存取在使用alertview後,我的方法嘗試使用searchbar..the shouldChangeTextInRange叫...但在此之前沒有searchBar:shouldChangeTextInRange:replacementText不叫
-(void) searchBarTextDidBeginEditing:(UISearchBar *)searchBar {
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
return YES;
}
-(BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
return YES;
}
-(BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar {
return YES;
}
-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
}
我做了一個測試,並把alertview視圖中沒有加載...釷searchBar工作...但我不想alertView:S – Ladessa