Hello
I have this little code
NSMutableArray *myArray = [[NSMutableArray alloc] init];
NSNumber *myNumber = [NSNumber numberWithDouble:752.65];
[myArray addObject:myNumber];
With this code I store Objects inside an array. But now I have two objects independent from each other.
If I change myNumber after it's been added to the a...
I'm having some trouble with displaying results from a datasource. This code will show a different (and correct) result in the console, but results in all kinds of random crap in the simulator.
("results" is an NSMutableArray property for the class.)
-(void) handleSearchForKeywords: (NSString *) keywords {
[results removeAllObjects...
A real beginners question.
I have a NSView subclass in which I create a NSMutableArray containing NSValues. When I want to write the array to a file using writetofile:atomatically: the file is created but it contains none of the NSValues that the mutable array does contain.
Does anyone know how I successfully can write this mutable array...
Hello:
I am parsing an XML file for two elements: "title" and "noType". Once these are parsed, I am adding them to an object called aMaster, an instance of my own Master class that contains NSString variables.
I am then adding these instances to an NSMutableArray on a singleton, in order to call them elsewhere in the program. The pro...
I have a for-loop. Inside that loop I want to fill up an NSArray with some objects. But I dont see any method that would let me do that. I know in advance how many objects there are. I want to avoid an NSMutableArray, since some people told me that's a very big overhead and performance-brake compared to NSArray.
I've got something like...
I'm looking for a method of turning a NSMutableArray into a string. Is there anything on a par with this Ruby array method?
>> array1 = [1, 2, 3]
>> array1.join(',')
=> "1, 2, 3"
Cheers!
...
The documentation doesn't say anything about that. When an old object is "removed" and a new one comes into it's place, then what happens with the old one? Do I have to release it by myself?
...
I am trying to insert a new cell into a table view where the data is sorted. Is there an easy & efficient way to do this using the API?
The easiest way seems to be insert the new data into an NSMutableArray, sort using a sort descriptor, and call reloadData. This should only redisplay the visible rows, so it doesn't look too bad.
Would...
Hi,
I have a custom class "Person".
Several Person objects have been created and added to an NSMutableArray called 'personArray'.
I'm then going to pass one of these to the next view, called userView.
These have all been Allocated and Initialised.
The code I am using is:
[userView setPerson:[personArray objectAtIndex:indexPath.row]...
Here is the gist of some code I'm writing. I'm concerned that I am not properly addressing the retain/release issues with the array class method on NSMutableArray. Is the following actually leaking memory?
for(a while) {
// do stuff
NSMutableArray *a = nil;
// do stuff
if (!a) {
a = [NSMutableArray array];
}...
I am polling an HTTP API - it returns one item at a time, in real-time (about every 4 seconds). As each item is received, I would like a new UITableView cell to be populated. The full list of received items must remain in a class property, I'm guessing an NSMutableArray. What is the best way to initialize an NSMutableArray as a class pro...
okay, I know I am new to obj-c, but for all intents and purposes the following below SEEMS like it should work:
songCollection = [[NSMutableArray alloc] init];
[songCollection addObject:@"test"];
//Array is init, and I can see it in the debugger.
songCollection = [GeneralFunctions getJSONAsArray:@"library"];
// I can see...
hi!!
I have a problem here, Im creating UILabels dynamically to be displayed into a UIView,
here is the code:
for (flower in flowerList)
{
// Create the Qty label
CGRect rectQty = CGRectMake(x , y, 25, labelHeight);
UILabel *flowerQuantityLabel = [[UILabel alloc] initWithFrame:rectQty];
NSString *fQty = [[NSStrin...
I like the convenience of NSMutableArray but sometimes you just need to drop down to good ole C-arrays. Like when you are feeding interleaved vertex arrays to OpenGL.
What is the fastest way of copying the contents of an NSMutableArray to a C-array?
Yah, I realize this bit shuffling introduces inefficiency but I'd like to see if I can...
Is it possible to use the:
[NSMutableArray writeToURL:(NSString *)path atomically:(BOOL)AuxSomething];
In order to send a file (NSMutableArray) XML file to a url, and update the url to contain that file?
for example:
I have an array and I want to upload it to a specific URL and the next time the app launches I want to download tha...
I'm sorry for opening a new question, I had to - as I wrote the other question from my iPhone as unregistered user and it is not very comfortable to write from the iPhone.
Rephrasing the question:
Is it possible to use the:
[NSMutableArray writeToURL:(NSString *)path atomically:(BOOL)AuxSomething];
In order to send a file (NSMuta...
In the following code, I try to read data from a plist:
-(void)readPreferences
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSMutableArray * myAppDefaults = [defaults mutableArrayValueForKey:@"LastList"];
myCustomObject * savedObject;
NSUInteger i;
for (i = 0; i < [my...
I have an NSTableView that binds to an NSArrayController, which in turn binds to an object property that returns an NSMutableArray.
This array is listening for events in a separate part of the application and updates itself internally. The model object that owns an instance of the array does not make any changes to the array.
I know th...
Hi,
I was wondering - is it possible to change files that are stored on some sort of
webhosting service via PHP? I mean I have a URL say: "plist.atwebpages.com/action.php" will it possible for this method to write a file onto the ftp server on the web hosting service?
e.g. http://www.batcave.net
...
Yet another C#/.NET guy trying to learn Objective-C with big dreams of making millions with an iPhone app :)
Ok, I'm sure this question stems from me being so used to static typed languages, and therefore am having a tough time adjusting, but here's my issue. Let's assume I have a class called MyObect:
MyObject.h
@interface MyObject :...