有人可以解释为什么这不起作用:
int nrSegments=[segment valueForKeyPath:@"iteneryLegs.@count"];
if (0==nrSegments) {
[self removeSegment:segment];
}
但是这样做了?
int nrSegments=[[segment valueForKeyPath:@"iteneryLegs] count];
if (0==nrSegments) {
[self removeSegment:segment];
}
答案 0 :(得分:2)
因为valueForKeyPath:@“iteneryLegs。@ count”返回NSNumber?