我正在尝试在 Apple 开发人员网站上合并两个示例代码,名为 *2_SimpleSectionedTableView* 和TableSearch。
本质上,我希望能够使用 aUISearchBar
来过滤带有部分的时区表。下面的代码使我的应用程序崩溃说
不兼容的整数到指针的转换。
这是什么意思,我该如何解决?
- (void)filterContentForSearchText:(NSString*)searchText
{
/*
Update the filtered array based on the search text and scope.
*/
[self.filteredListContent removeAllObjects]; // First clear the filtered array.
/*
Search the main list for products whose type matches the scope (if selected) and whose name matches searchText; add items that match to the filtered array.
*/
for (NSInteger i=0; i<[self.regions count]; i++)
{
Region *region = [self.regions objectAtIndex:i];
for (NSInteger j=0; j<[region.timeZoneWrappers count]; j++) {
{
NSComparisonResult result = [[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndexes:i length:j] ].textLabel.text compare:searchText options:(NSCaseInsensitiveSearch|NSDiacriticInsensitiveSearch) range:NSMakeRange(0, [searchText length])];
if (result == NSOrderedSame)
{
[self.filteredListContent addObject:[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathWithIndexes:i length:j]]];
}
}
}
}
}