NSArray* address = [NSArray arrayWithArray:[detailItem addressArray]];
NSLog(@"address = %@", address);
NSString* addressToString = @"";
int arrayCount = [address count];
for (int i = 0; i < arrayCount; i++) {
addressToString = [addressToString stringByAppendingString:[address objectAtIndex:i]];
if (i == arrayCount -1) {
...
I have an NSDictionary with NSStrings
Some of the valueForKey:@"Key" have no entry so it's (null)
NSMutableString* addressDictionaryToString = [NSMutableString string]; // use mutable string!
for (NSDictionary* item in address) { // use fast enumeration!
[addressDictionaryToString appendFormat:@"%@, %@, %@, %@",
[...
Really beginner question here.
I have an NSArray of images which in its last line has an error in Xcode saying that the "initializer element is not constant".
any help please?
...
Okay, coming from a perl background I am used to Arrays holding refs to Hashes (Dictionary in iPhone parlance).
What I would like to know is this: If I have a NSArray of NSMutableDictionaries. Say I added the following NSMutableDictionary to an NSArray:
[theArray addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys: timest...
I have a JSON return being formatted and saved into a plist, it looks like the following:
I need it to have the following format:
I'm missing something in the saving of the array so I can add the "Rows" below the Root and "Item 0, etc" under the profile, any ideas?
Here is my code:
NSURL *url = [NSURL URLWithString:@"http://1...
I have 2 NSArray's that are holding values...
For example NSArray 1 has values 1 2 4 in it
and NSArray 2 has values 1 2 4 5 6 in it.
How can I write code to compare these 2 arrays to get the following information...
Count the values that are the same (so in this case 3) and count the values that are not the same (in this case 2).
I ...
I have the following code (both items and itemsCopy are NSMutableArray's):
//DO: populate items w/ 30 elements
[self.itemsCopy addObjectsFromArray:self.items];
//DO: remove all elements in items
Results
Begin Pass 1:
itemsCopy = 0
items = 30
End Pass 1:
itemsCopy = 30
items = 0
Begin Pass 2:
itemsCopy = 0
items = 30
End Pass 2:
it...
I'm trying to teach myself but am struggling with how to store something like an NSArray inside an NSDictionary.
Let's say hypothetically you had a NSDictionary for recipes:
Let's say the NSDictionary had keys like:
Spaghetti,
Fettucine Alfredo,
Grilled Chicken Salad
And the NSDictionary had an NSArray which was simply a list of ingr...
I have the following code:
self.itemsCopy = [self.items mutableCopy];
//[self.itemsCopy addObjectsFromArray:self.items];
NSLog(@"------- BEFORE APPEND --------");
NSLog(@"items count: %d",[items count]);
NSLog(@"itemsCopy count: %d",[itemsCopy count]);
My results are:
------- BEFORE APPEND --------
items count:...
What is the difference between these two NSArray methods?
...
I am creating an NSArray from a URL that points to a plist
NSLog(@"_url rc:[%d]",[_url retainCount]); //prints "_url rc:[1]"
content = [NSArray arrayWithContentsOfURL:_url];
NSLog(@"_url rc:[%d]",[_url retainCount]); //prints "_url rc:[10]"
I'm completely at a loss as to why this is occurring. Let me know if you need further informat...
I have an NSArray of UILocalNotification objects that I need to sort according to a key within the UILocalNotification's userInfo property, which is an NSDictionary. I know how to sort NSArrays by a value that is one level deep, e.g., a key within an array of NSDictionaries, but two levels deep I'm lost. I want to do something like this ...
Hello,
I want to ask about the NSArray in objective C.
I want to create a dynamic array as I don't know about the size of the array. And I also want to insert some of the data to the array. However, I don't know how to decl, init and insert the element in to the array.
The following is the C++ version.
I want to create a empty array A...
Can someone help me with some code to check for duplicates in an NSArray for obective C. I did what I want in vb.net but the translation is hard for me.
'True means no duplicates'
Public Shared Function checkDuplicate(ByVal list As ArrayList) As [Boolean]
Dim [set] As New HashSet(Of Integer)
For i As Integer = 0 To list.Count - ...
I have a class, let's call it ABC, with an NSArray *objects property, and the objects in the NSArray can be one of two different classes, X and Y. Both X and Y have a path property, but the compiler doesn't know this.
Therefore, even though ABC will always find the path property on my array objects, I get compiler warnings on my code -...
Can someone help me fix my code here. I am trying to do something simple iterate through the whole array that has NSString's in it convert them to NSIntegers and assign them to a NSInteger variable.
for (NSInteger *itemF in myNSArray) {
//WHERE "slotA" is an NSInteger and "itemF" is stored as an NSString and I wanna conver to NSI...
I am having problems initalizing an NSArray and adding integers to it here is my code below which I commented in what I am trying to accomplish can someone help me fix it? my app crashes when adding an object, but I dont know if I am clearing the array correctly either.
//CREATE AND INITIALIZE AN ARRAY
NSArray *ticket; ...
This is the code that I would use if it was always single spaces in between words. Since I have multiple spaces in between some words how can my code be changed to remove the extra spaces when using componentsSeparatedBySring. I'm new to OBjective-C so any help would be greatly appreciated!
Here is my code:
NSString *myString = @"One Tw...
I've got an array (actually a mutable array) of NSStrings, and I want to find out how many unique elements the are in the array.
For instance, say the array is made up of:
Orange, Lemon, Lemon, Orange, Lemon
Then there are just two unique elements (Orange and Lemon). And this array:
Paul, Steve, John, Harry, Paul, John
..has four ...
Say you have a class Person (with name, age, etc), and an array called PeopleArray which has several individual Person's.
What's the easiest way of extracting each Person's name (for instance) and putting it into an array.
Psuedocode is:
nameArray = every Person's name, from the array PeopleArray
...