Number of objects in an NSArray
Hi, I was wondering if there was any possible way to get the number (count) of objects in an NSArray Object ...
Hi, I was wondering if there was any possible way to get the number (count) of objects in an NSArray Object ...
Hi all, I have a problem with arrays and passing images between views that I would like some help on! So the background is that I have: • RootViewController (which handles my table view) • CommunicationViewController which handles the detail of the selected element from the table • SelectSlideViewController which displays an image cli...
NSArray *test1 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSArray *test2 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSArray *test3 = [NSArray arrayWithObjects:@"1",@"2", nil]; NSLog(@"%d", [test1 count] == [test2 count] == [test3 count]); Will print 0. Why? ...
How to remove an item from NSArray. ...
I'm using an array to store cached objects loaded from a database in my iPhone app, and was wondering: are there any significant disadvantages to using NSMutableArray that I should know of? edit: I know that NSMutableArray can be modified, but I'm looking for specific reasons (performance, etc..) why one would use NSArray instead. I ass...
What's the simplest way to extract a slice of an NSArray in Objective-C? (much like the array_slice function in PHP) ...
Assumed having the class Account with Name and accountNo both as NSStrings. I want to sort an Array of Accounts either by name or by accountNo. The sort should be done localized. If I use NSSortDescriptors as described in the Guides I have the option to pass localizedCaseInsensitiveCompare: to the Array, but the numbers are not sorted c...
I have an NSArray, and I want to split it into two equal pieces (if odd "count" then add to the latter new array) - I want to split it "down the middle" so to speak. The following code does exactly what I want, but is there a better way?: // NOTE: `NSArray testableArray` is an NSArray of objects from a class defined elsewhere; NSMuta...
Hi everyone, I've come across a problem related to pointers within arrays in objective-c. What I'm trying to do is take the pointers within an NSArray, pass them to a method, and then assign the returned value back to the original pointer(the pointer which belongs to the array). Based on what I know from C and C++, by dereferencing th...
Hello, how can i check a variable is NSArray or NSMutableArray??? Thanks ...
I have an int which defines the objectAtIndex, which gives it to the string, which then displays it in the UILabel, HOWEVER, when I modify the array (add a word to it in this case) when I have the UILabel go through the array it only displays the odd ones. I have done an NSLog and found out that it DOES PASS EVERY SINGLE THING to the st...
I have an NSArray that I pass in through a delegate method: - (void)didFinishParsing:(NSArray *)array { [self.myArray addObjectsFromArray:array]; NSLog(@"%@", self.myArray); [self.tableView reloadData]; } There's only one object in the array and I'd like the tableView row count to equal the amount of objects in the array o...
This feels like such a stupid question, but how can I find a string in an NSArray? I tried using [array indexOfObjectIdenticalTo:myString] but that requires the sting to have the same address. Does anyone have any tips on how to do this? ...
I was wondering how do I go about creating an NSArray with say numbers 1-100 to be used in a UIPickerView. I know from other programming classes I could do: int array[100]; for (int i=1, i<=100, i++) array[i]=i; But I am not sure how to something equivalent with NSArray, instead of manually typing in all the values. I searched it...
Hello, I am wondering how to convert an NSArray example: ( [43,545,@"Test"] ) to a string in objective-c. An applescript example might be: set the_array to {43,"Testing", 474343} set the_array to the_array as string ...
Hi all, I have a problem, and I reckon there's a really straightforward solution to it, but I can't fathom it out! I have this piece of code: NSManagedObjectContext * context = [[NSApp delegate] managedObjectContext]; NSManagedObjectModel * model = [[NSApp delegate] managedObjectModel]; NSDictionary * entities ...
I have an NSString I'm working with, but I would like to parse it by character length. So break it apart into an NSArray, and have each object in the array be x characters from that string. So basically, break up the string into sub strings of a certain length So, how do I do it? example: NSString *string = @"Here is my string" NS...
In my UIView nib file, I've got a UITableView which takes up about half the screen. The correpsponding .h and .m files are: // helloViewController.h #import <UIKit/UIKit.h> @interface helloViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { NSArray *locationArray; } @property (nonatomic, retain) NSArray ...
I would like to search through my NSArray for a certain string. Example: NSArray has objects: "dog", "cat", "fat dog", "thing", "another thing", "heck here's another thing" I want to search for the word "another" and put the results into one array, and have the other, non results, into another array that can be filtered further. ...
This is probably obvious, but I'm a bit of a newbie and have spent hours trying to figure this out. In viewDidLoad() I have a call to a function on an MGTwitterEngine object (custom object), with an input. If the request (to Twitter, in this case) is successful, it calls an appropriate delegate method. In viewDidLoad(), it's like thi...