NSPredicate检查对象类的种类 [英] NSPredicate check for kind of object class

查看:122
本文介绍了NSPredicate检查对象类的种类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UIView 对象的数组。我想在此数组上调用 - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)谓词以获取 MyCustomView 的数组对象。

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

如何用isKindOf:编码谓词?

How to code predicate with "isKindOf:"?

推荐答案

尝试( depracated

[NSPredicate predicateWithFormat: @"className == %@", [someObject className]]

[NSPredicate predicateWithFormat: @"class == %@", [someObject class]]

这篇关于NSPredicate检查对象类的种类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆