Check that NSArray is sorted

I have an NSMutabaleArray and I want to check it whether it would be in sorted mode or not after insertion of any element. So what would be the fastest technique to do that.You need one loop to traverse and check if array[i+1] is greater than array[i

Order of the data extracted from the analysis

I am a beginner , i am trying to retrieve user details from _User class like this : var data:NSMutableArray = NSMutableArray() func loadData() { data.removeAllObjects() var userQuery = PFUser.query() userQuery?.findObjectsInBackgroundWithBlock({ (obj

Filling NSmutableArray problem in Objective-C

I am trying to create an algorithm that essentially finds anagrams for a given word (Code below). After the user inputs their word, they press a button, and what it should be doing is looking at an array of words (populated from a txt file; I know th

Crashing App: Mutation Method Sent to an Immutable Object

I am trying to add an object to an NSMutableArray. Initially I assign some response data to the array, and can display it in a table view. After loading more data, it seems to be crashing when trying to add the new information to my original array. I

Delete NULL Objects from the Mutable Array in Objective c

I have a mutable array of checked box NSMutableArray *arrayOfCheckedBox = [NSMutableArray arrayWithObjects:namePropertyString, lastNamePropertyString, companyPropertyString, workEmailPropertyString, personalEmailPropertyString, workPhonePropertyStrin

Check if a unique object exists in NSArray

I have an NSMutableArray where objects can be added to. The objects added are SUPDataValue objects containing a bunch of SUP data. In an other view, I take this object array and divide it into an NSMutableArray containing an NSMutableArray for every

Nsinteger accessible problem

When I try to add nsinteger value into array it shows warning, Incompatible pointer to integer conversion sending 'NSInteger *' (aka 'int *') to parameter of type 'NSInteger' (aka 'int'); dereference with * and crashed when reach the code [sizary1 ad

Adding int to NSMutableArray initWithCapacity

I'm trying to create a mutable array of two integers @interface ViewController () { NSMutableArray *myArray; } initialized with capacity of two objects - (void)viewDidLoad { [super viewDidLoad]; myArray = [[NSMutableArray alloc]initWithCapacity:2]; [

Delete the object from NSMutableArray?

I have an array with following elements in ViewDidLoad method inputArray = [NSMutableArray arrayWithObjects:@"car", @"bus", @"helicopter", @"cruiz", @"bike", @"jeep", nil]; I have another UITextF

NSMutableArray adding in a cycle

I have this... allTableData = [[NSMutableArray alloc] initWithObjects: [[Food alloc] initWithName:@"1" andDescription:@"Hi man!"], [[Food alloc] initWithName:@"2" andDescription:@"Hi woman"], nil ]; How can I do som

Creating a custom collection of custom classes in Objective C

In the iOS app I'm building, I am currently managing a list of objects (Tasks) by using an NSMutableArray containing a number of NSMutableDictionary objects for each individual task. I would now like to encapsulate the logic I'm writing for managing

Add UIImage to NSMutableArray

I have a problem with a piece of code that should add images to a NSMutableArray. For some reason the images are not added (the count of the array stays at 0). Can someone please tell me what I'm doing wrong here? - (void)incomingNotification:(NSNoti

setValue: forKey: Sets all values ​​for the specified index

I know this is going to be really basic, but I can't seem to figure it out. I have an NSMutableArray with two indexes, each with an NSMutableDictionary with a few values. I want to change one value in one index with [[anArray objectAtIndex:index] set

how to remove NULL values ​​from NSMutableArray? ios

i have array of birthdates as array is getting filled from facebook so there are some friends whos birthdates are private so it contain NULL how to convert that array like empty string wherever there is null value the array is like below "<null>

Effective way to generate a random alphabetic string?

I want a string of all the characters of the alphabet randomized. Right now, I create a mutable array of the 26 characters, shuffle them with the exchangeObjectAtIndex: method and then add each character to a string that I return. There has to be a b

Access NSMutableDictionary in NSMutableArray

I have an NSMutableArray of NSMutableDictionary (it's a plist). Each dictionary in the array has 2 keys: 'id' and 'lu'. How can I find the index in NSMutableArray of NSMutableDictionary where, for example, id = '47653'? I tried to do it but it's not

How to get the first characters of a string array insensitive

In my iPhone app i have an array of stings. fron that string i need to get the array of first charecters. For this i have implemented logic as follow. it works but in this i have retrieve charectes twicw 1.Small letters and 2.Capital letters. I need

NSMutableArray addObject replaces data

I am adding an object "m" to NSMutableArray as follows: [m setObject:a forKey:@"a"]; [m setObject:b forKey:@"b"]; [m setObject:c forKey:@"c"]; [m setObject:d forKey:@"d"]; [myArray addObject:m]; [m release

add strings to NSMutableArray in NSMutableDictionary

I need to append strings to an array kept inside of a dictionary each time a word matches a pattern of another word. The second line below (setObject) overwrites instead of appending. The end result should be arrays in a dictionary where the the key(

All elements in NSMutableArray disappear after copying

I am initializing a view controller with a NSMutableArray. But in init, I have to init with NSMutableArray, but all the elements disappeared after that. UIViewController* vc = [[[PhotoAlbumViewController alloc] initWithImages:imageArrayBig] autorelea

Memory leak on the device when using mutableCopy

I thought that I was really close to release this new App of mine when I ran into a dead end. My code works without memory leaks in the simulator (Xcode 4.0.2) but reports memory leaks on my devices. I think my issue is related to that I copy an obje

Having problems with adding objects to NSMutableArray

I am having problem with adding objects to NSMutableArray *array. // Controller.m #import "Controller.h" @implementation Controller - (void)parser:(NSString *)string{ [array addObject:string]; NSLog(@"answerArray(1): %@",[array objectA

Objective C: Why does not my NSMutableArray work?

I'm quite new to ObjC and its mutable arrays. This is driving me crazy ;-) I do the following: mColumns = [NSMutableArray array]; for( int i=0; i<5; i++ ) [mColumns addObject:[[MyColumn alloc] init]]; After that code my array "mColumns" conta

How can I change a mutable property in Objective C?

I am trying to edit a mutable array from a property and can't seem to directly make it work. Consider the following code that seems to work, but seems also very inefficient; I have to copy the whole property array just to make a change in one object.

out of range - NSMutableArray error

data = [[NSMutableArray arrayWithCapacity:numISF]init]; count = 0; while (count <= numISF) { [data addObject:[[rouge_col_data alloc]init]]; count++; } When I step through the while loop, each object in the data array is 'out of scope' rouge col data