Ios7 表视图上的搜索栏崩溃
这张桌子放得很好。但当我在搜索栏中输入任何内容时,我的应用程序就会崩溃。有什么想法吗?我找遍了,但找不到解决办法。这是我的密码:Ios7 表视图上的搜索栏崩溃,ios7,xcode5,uisearchbar,Ios7,Xcode5,Uisearchbar,这张桌子放得很好。但当我在搜索栏中输入任何内容时,我的应用程序就会崩溃。有什么想法吗?我找遍了,但找不到解决办法。这是我的密码: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { FGProfileListUserCell *cell = [self.tableView dequeueReusableCellWithIde
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
FGProfileListUserCell *cell = [self.tableView dequeueReusableCellWithIdentifier:ProfileListUserCellIdentifier];
if (cell == nil) {
cell = [[FGProfileListUserCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ProfileListUserCellIdentifier];
cell.lblUsername.text = [searchResults objectAtIndex:indexPath.row];
}
if (tableView == self.searchDisplayController.searchResultsTableView) {
cell.lblUsername.text = [searchResults objectAtIndex:indexPath.row];
}
else {
cell.lblUsername.text = [arrayUsernames objectAtIndex:indexPath.row];
}
NSLog(@"Return Cell");
return cell;
}
enter code here
您收到的错误消息是什么?***在-[UISearchResultsTableView\u configureCellForDisplay:forIndexPath:]中的断言失败,我可能弄错了,但是如果我使用“GProfileListUserCell*单元格=[self.tableView dequeueReusableCellWithIdentifier:ProfileListUserCellIdentifier];”和“如果(tableView==self.searchDisplayController.searchResultsTableView)”,它不应该加载我故事板中的原型单元吗?当表初始化时,它可以正常加载,但当我开始搜索时,它会崩溃,或者如果我弄乱了代码,我的原型单元格不会加载。