Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 折叠UITableView_Iphone_Objective C_Ios_Uitableview - Fatal编程技术网

Iphone 折叠UITableView

Iphone 折叠UITableView,iphone,objective-c,ios,uitableview,Iphone,Objective C,Ios,Uitableview,嘿,各位,我在我的应用程序中创建了一个UITableView,当一个单元格被触摸时,它会扩展我遇到的问题是它不会崩溃无论我做了什么尝试,我确信这很容易,我只是想不出它崩溃的唯一时间是当它被另一个单元格点击时 这是我的密码: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { selectedCellIndexPath = indexPath;

嘿,各位,我在我的应用程序中创建了一个UITableView,当一个单元格被触摸时,它会扩展我遇到的问题是它不会崩溃无论我做了什么尝试,我确信这很容易,我只是想不出它崩溃的唯一时间是当它被另一个单元格点击时

这是我的密码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{    
    selectedCellIndexPath = indexPath;

    [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];

    if (selectedCellIndexPath) {
        selected = YES;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{        
    if(selectedCellIndexPath != nil  
       && [selectedCellIndexPath compare:indexPath] == NSOrderedSame)  
        return 150;

    return 44;
}

您永远不会将
selectedCellIndexPath
更改为
nil
,因此在选择新行之前不会更改当前选定行。在
didselectrowatinexpath
中,应将开头更改为以下内容:

if (selectedCellIndexPath == indexPath)
  selectedCellIndexPath = nil;
else
  selectedCellIndexPath = indexPath;

您永远不会将
selectedCellIndexPath
更改为
nil
,因此在选择新行之前不会更改当前选定行。在
didselectrowatinexpath
中,应将开头更改为以下内容:

if (selectedCellIndexPath == indexPath)
  selectedCellIndexPath = nil;
else
  selectedCellIndexPath = indexPath;

我已经创建了正在折叠的UITableView

http://www.codeproject.com/Articles/240435/Reusable-collapsable-table-view-for-iOS


它工作得很好

我已经创建了正在折叠的UITableView

http://www.codeproject.com/Articles/240435/Reusable-collapsable-table-view-for-iOS


它工作得很好

调用行重新加载函数时,它是否进入cellForRow委托函数?如果是,则在检查所选行后,应使用一些功能折叠行。

当调用行重新加载函数时,是否进入cellForRow委托函数?如果确实如此,则在检查选定行后,应使用一些功能折叠行。

检查以下链接:-检查以下链接:-