searchDisplayController 引起的数组越界处理办法
下面把searchDisplayController引起的数组越界处理办法给大家分享如下:
当[searchDisplayController.searchResultsTableViewsetSeparatorStyle:UITableViewCellSeparatorStyleNone]时,发送了崩溃
错误提示如下:
Terminatingappduetouncaughtexception'NSRangeException',reason:'***-[__NSArrayIobjectAtIndex:]:index1beyondbounds[0..0]' ***Firstthrowcallstack: ( 0CoreFoundation0x000000010c6c6c65__exceptionPreprocess+165 1libobjc.A.dylib0x000000010c35fbb7objc_exception_throw+45 2CoreFoundation0x000000010c5bd17e-[__NSArrayIobjectAtIndex:]+190 3UIKit0x000000010d230fd2-[UITableViewDataSourcetableView:indentationLevelForRowAtIndexPath:]+106 4UIKit0x000000010cdfb1b9__53-[UITableView_configureCellForDisplay:forIndexPath:]_block_invoke+1711
查了好久才查到原因:在错误log中有提示
3UIKit0x000000010d230fd2-[UITableViewDataSourcetableView:indentationLevelForRowAtIndexPath:]+106
解决方法:
-(NSInteger)tableView:(UITableView*)tableViewindentationLevelForRowAtIndexPath:(NSIndexPath*)indexPath
{
return0;
}
以上代码就是针对searchDisplayController引起的数组越界处理办法的解决方案,希望对大家有所帮助。
热门推荐
10 分别发的祝福语简短
11 大外甥高考祝福语简短
12 小学毕业校长简短祝福语
13 搞工程发财祝福语简短
14 冬季祝福语男生文案简短
15 同事生子问候祝福语简短
16 退休文案寄语简短祝福语
17 送给自己的祝福语简短
18 简短祝福语毛笔字