I have an array. I want to check whether there is an object present in a particular index or not. How to do this? Please help.
if you just want to check if there is an object
if (myIndex < [array count])
if you want to find a specific object
[array indexOfObject:myObject];
if you want to know if the object at some index is of some class
[[array objectAtIndex:myIndex] isKindOfClass:[TheClassToCompareTo class]];
BOOL exists = index < [array count] ? YES : NO;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With