0

I have an array which contains text data and image data.If data is text i need to display it in a label otherwise in an imageview.But how to detect whether its a text or image?

2
  • How is imageData stored in the array? Commented Sep 20, 2012 at 11:22
  • Have u stored both image and text in one array ? Commented Sep 20, 2012 at 11:24

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

4 Comments

the questioner has mention to display it in a label so i assume its a text
+1 well don't expect him to accept your answer anyways ... (And not because it is not correct) :)
then what is for image class and video class
image are saved directly as UIImage object but you can save it also as NSData but normally for video only the paths are saved in the array

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.