大家好,谢谢大家,情况是这样的,当我使用以下方法填充我的数组时,当我使用方法 2 时它不起作用。目标是改变文本的颜色。两种方法都经过 NSLOGED,数据相同。
第一种方式..(工作名称变灰)
-cellForRowAtIndexPath
....
if ([self.secArray containsObject:indexPath]) {
cell.textLabel.textColor = [UIColor grayColor];
} .....
-didSelectRowAtIndexPath:
...
[secArray addObject:indexPath];
第二种方式(不工作 - 从我的 .plist 填充数组)
-cellForRowAtIndexPath
....
if ([self.secArray containsObject:indexPath]) {
cell.textLabel.textColor = [UIColor grayColor];
} .....
-viewWillAppear
NSString *filePathOrdersIndex = [self dataFilePathOrders];
NSMutableArray *chekDist;
chekDist = [[NSMutableArray alloc] initWithContentsOfFile:filePathOrdersIndex];
NSLog( @"data checkDist........... %@", chekDist);
if(!chekDist){
chekDist = [[NSMutableArray alloc]init];
}
for(id dist_data in chekDist){
secArray = [dist_data objectForKey:@"myIndexPath"];
//[secArray addObject:[dist_data objectForKey:@"myIndexPath"]];
}
记录到控制台的两种方法都包含相同的数组数据....但是第二种方法不起作用
任何帮助是极大的赞赏。