searchDisplayController 時引起的數組越界,數組越界

來源:互聯網
上載者:User

searchDisplayController 時引起的數組越界,數組越界

當  [searchDisplayController.searchResultsTableView setSeparatorStyle:UITableViewCellSeparatorStyleNone] 時, 發送了崩潰

錯誤提示如下:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'*** First throw call stack:(0   CoreFoundation                      0x000000010c6c6c65 __exceptionPreprocess + 1651   libobjc.A.dylib                     0x000000010c35fbb7 objc_exception_throw + 452   CoreFoundation                      0x000000010c5bd17e -[__NSArrayI objectAtIndex:] + 1903   UIKit                               0x000000010d230fd2 -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 1064   UIKit                               0x000000010cdfb1b9 __53-[UITableView _configureCellForDisplay:forIndexPath:]_block_invoke + 1711

查了好久才查到原因: 在錯誤log中有提示

3   UIKit                               0x000000010d230fd2 -[UITableViewDataSource tableView:indentationLevelForRowAtIndexPath:] + 106

解決方案:

-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{    return 0;}

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.