【发布时间】:2011-02-11 05:09:42
【问题描述】:
在表格中搜索时,我在执行以下代码时遇到问题。此代码在其他地方工作正常。但目前它给出了一个错误,因为
[_UITableViewSeparatorView rangeOfString:]: 无法识别的选择器发送到实例 0x6041790
以下是困扰我的代码。请让我知道那里的错误。
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
[tableData removeAllObjects];// remove all data that belongs to previous search
if([searchText isEqualToString:@""] || searchText==nil)
{
[displayTable reloadData];
return;
}
NSInteger counter = 0;
for(NSString *name in dataSource)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
NSRange r = [name rangeOfString:searchText];
if(r.location != NSNotFound)
{
if(r.location== 0)//that is we are checking only the start of the names.
{
[tableData addObject:name];
}
}
counter++;
[pool release];
}
[displayTable reloadData]; }
提前致谢!!
期待您的回复。
谢谢
【问题讨论】:
标签: iphone objective-c xcode memory-management runtime-error