searchDisplayController 引起的数组越界处理办法_IOS

下面把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 + 165

1  libobjc.A.dylib           0x000000010c35fbb7 objc_exception_throw + 45

2  CoreFoundation           0x000000010c5bd17e -[__NSArrayI objectAtIndex:] + 190

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

4  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;
}

以上代码就是针对searchDisplayController 引起的数组越界处理办法的解决方案,希望对大家有所帮助。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索数组越界异常
display controller、uisearchcontroller、ios searchcontroller、searchcontroller、searchviewcontroller,以便于您获取更多的相关知识。

时间: 2024-08-30 19:50:15

searchDisplayController 引起的数组越界处理办法_IOS的相关文章

各位大神,传递图片问题,学长说是数组越界,不知道怎么解决

问题描述 各位大神,传递图片问题,学长说是数组越界,不知道怎么解决 图片传递代码图片接收代码 解决方案 不是内存溢出,而是有变量为null 解决方案二: 我觉得你的学长判断是错误的,因为错误消息已经写了:NullPointerException,这个异常消息的含义就是说有空对象调用了方法.所以不会是内存溢出(不完全排除,但可能性很小),而你所指出的那行代码上有一个空对象调用了方法. 我看过你的代码,你箭头所指向的代码一共有4个对象调用了方法,其中intent对象已经看到了你new的代码,所以它不

一个数组越界的C++程序

学生给我发了私信,一个程序运行了好久,在OJ就是提交不了. 题目是: Description输入10个整数,将其中最小的数与第一个数对换,把最大的数与最后一个数对换.写三个函数: ①输入10个数:②进行处理:③输出10个数. Input10个整数 Output整理后的十个数,每个数后跟一个空格(注意最后一个数后也有空格) Sample Input2 1 3 4 5 6 7 8 10 9Sample Output1 2 3 4 5 6 7 8 9 10 HINT  主函数已给定如下,提交时不需要包

string-java选择排序使用swap()函数出现数组越界报错

问题描述 java选择排序使用swap()函数出现数组越界报错 class SelectSort{ public static void Swap(int[] arr,int i,int j){ int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } public static void PrintArray(int[] Array){ for(int i=0;i<Array.length;i++){ System.out.print("

java小白求大神帮看一下为什么会发生数组越界。代码如下:

问题描述 java小白求大神帮看一下为什么会发生数组越界.代码如下: package arraytest; public class ArrayTestSort { public static void main(String[] args) { int i,j=0; int[] arr = new int[]{100,40,60,87,34,11,56,0}; int temp = 0; for(i = 0;i<arr.length;i++){ for(j = 0;j<arr.length-

java连连看数字换图片数组越界问题

问题描述 java连连看数字换图片数组越界问题 Jbutton 按钮数字换成图片后,只有部分按钮有图片,有的按钮上的图片不能显示.提示说数组越界,但具体不知道怎么回事.按钮数组是6*5,存储按钮位置的数组是8*7,调用图片的代码private static Icon[] icons = new ImageIcon[6*5]; private static final String imgDir=""d:/shuiguo"";static{ try{ File dir

ExpandableListView动态刷新出现数组越界,求帮忙

问题描述 ExpandableListView动态刷新出现数组越界,求帮忙 childView是4个textView组成,GroupView就是一个textView. 本身是3个组,当刷新变成4个组时,出现数组越界 这行代码:info = map11.get(key).get(childPosition); 现在不知道怎么解决数组越界问题,listview的数组越界可以用list.clear()方法, 这个ExpandableListView是第一次用,知道的帮忙下,谢谢了.急用 部分代码如下:

如何处理数组越界而不会让程序崩溃?

如何处理数组越界而不会让程序崩溃? 数组越界是非常常见的现象,有时候,你的程序中,因为数组越界而崩溃了,很难找,理想的状态是,数组越界的时候给我们返回nil就好了. 请看下面这个例子: // // RootViewController.m // BeyondTheMark // // Copyright (c) 2014年 Y.X. All rights reserved. // #import "RootViewController.h" @interface RootViewCon

c语言-C语言数组越界的含义

问题描述 C语言数组越界的含义 听同学说C语言数组越界会导致出错,我试验了下不会,谁能写一个数组越界出错的例子? 解决方案 这个不一定能观察到,因为C没有越界检查,你可以这么写: int a[10]; int i=0; while (true) { a[i++] = i; } 肯定会报错 解决方案二: 越界不就是超过数组的大小,随便写个拷贝就行了 解决方案三: 例如你声明数组a[10],如果访问a[10]就发生越界错误,越界错误的本质是访问了未知内存空间,如果之前此区域内存被使用后,此时访问获得

java-IndexOutOfBoundsException数组越界的问题求解

问题描述 IndexOutOfBoundsException数组越界的问题求解 D/AndroidRuntime( 7415): Shutting down VM --------- beginning of crash E/AndroidRuntime( 7415): FATAL EXCEPTION: main E/AndroidRuntime( 7415): Process: com.android.settings, PID: 7415 E/AndroidRuntime( 7415): j