开发者

Unclear why if statement doesn't work

Can somebody explain why this doesn't work:

int nrSegments=[segment valueForKeyPath:@"iteneryLegs.@count"];
    if (0==nrSegments) {
        [self removeSegment:segment];
    }

but this does?

int nrSegments=[[segment valueForKeyPath:@"iteneryLegs] count];
    if (0==nr开发者_开发技巧Segments) {
        [self removeSegment:segment];
    }


Because valueForKeyPath:@"iteneryLegs.@count" returns an NSNumber ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜