this is my piece of code:
NSUInteger indexArr[] = {1,2,3,4};
NSIndexSet *indexSet =开发者_运维技巧 [NSIndexPath indexPathWithIndexes:indexArr length:4];
Is there a way to declare the indexArr inline, like
NSIndexSet *indexSet = [NSIndexPath indexPathWithIndexes:{1,2,3,4} length:4];
or something? It's because I'm writing a test with some reference Paths and I want to save lines of code that are not usefull for anybody...
Best regards, hijolen
The only problem with your attempt is that you need to cast it so that the compiler knows it is the right type.
NSIndexSet *indexSet = [NSIndexPath indexPathWithIndexes:(NSUInteger[]){1,2,3,4} length:4];
精彩评论