Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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 indexath.row的数据类型_Iphone_Objective C_Uitableview_Nsindexpath - Fatal编程技术网

Iphone indexath.row的数据类型

Iphone indexath.row的数据类型,iphone,objective-c,uitableview,nsindexpath,Iphone,Objective C,Uitableview,Nsindexpath,这是我的密码 NSInteger selectedRow = selectedStationPath.row; UITableViewCell *cellz = [tabView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:selectedRow inSection:0]]; UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.

这是我的密码

NSInteger selectedRow = selectedStationPath.row;
            UITableViewCell *cellz = [tabView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:selectedRow inSection:0]];
            UIColor *color = [[UIColor alloc] initWithRed:0.0 green:0.5 blue:1.0 alpha:0.2];
            cellz.contentView.backgroundColor=color;
            NSLog([NSString stringWithFormat:@"%i",selectedRow]);

selectedStationPath
是一个全局的
nsindepath
。。。如果我将一个数字而不是
selectedRow
放入
indexPathForRow
中,它会起作用。NSLog正确打印
selectedRow
,但是当我将
selectedRow
放入
indexPathForRow
时,即使NSLog正在打印
selectedRow

您可以记录selectedRow的值吗?是的,该值打印正确的行。它现在可以工作了。。。似乎我必须首先取消选择该行,否则它将不起作用。。。。这很奇怪,但现在它工作了…您如何在selectedStationPath中设置值???selectedStationPath位于选项卡视图的didSelectRow中