NSPredicate check for kind of object class

前端 未结 3 1494
梦如初夏
梦如初夏 2020-12-09 08:46

I have an array of UIView objects. I want to call - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate on this array to get array of <

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-09 09:13

    I got errors using Jef's method. This worked for me, though.

    NSPredicate *predicate = [NSPredicate predicateWithFormat:
                                                  @"self isKindOfClass: %@", class];
    

    Source: https://stackoverflow.com/a/2556306/168594

提交回复
热议问题