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中