检查数组中的数据类型

时间:2012-09-20 11:20:41

标签: iphone nsarray

我有一个包含文本数据和图像数据的数组。如果数据是文本我需要在标签中显示它,否则在imageview中显示。但是如何检测它是文本还是图像?

1 个答案:

答案 0 :(得分:2)

if([[array objectAtIndex:yourIndex] isKindOfClass:[Name_of_the_class_your_want_to_check_for class]])