i have this nsarray having images data in it images setting dynamically in array but i want to filter data if there is any nil nsdata i dont want it inside my nsarray how can i sort this array. here is my code.
NSData* imageData = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg"];
NSData* imageData1 = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg1"];
NSData* imageData2 = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg2"];
NSData* imageData3 = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg3"];
NSData* imageData4 = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg4"];
NSData* imageData5 = [[NSUserDefaults standardUserDefaults] objectForKey:@"profileImg5"];
self.pageImages = [NSArray arrayWithObjects:
[UIImage imageWithData:imageData],
[UIImage imageWithData:imageData1],
[UIImage imageWithData:imageData2],
[UIImage imageWithData:imageData3],
[UIImage imageWithData:imageData4],
[UIImage imageWithData:imageData5],nil];
nilobjects in anNSArray. If, for example,imageData1isnil, the array will only containimageDataand no other images.