Sometimes you may need to find/search a particular item in NSArray. How can you find whether a particular item is present in NSArray or not? Look at the code below.

BOOL testFlag= [yourArray containsObject:@"CoderzHeaven"];
if(testFlag) {
	NSLog(@“Yup! It's present!"); }
else {
	NSLog(@"Nopes! It's absent!"); }

Here ‘yourArray is your NSArray and ‘containsObject’ returns either TRUE or FALSE and it get stored in ‘testFlag’.



Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.