I am a newbie in Obj-C. I need to learn this better so please tell me what I am doing wrong..
I have an array of Images.... at various points of exec I need to replace the last element with one of the preceding images... so the last image always replicates one of the images before.
When I do the replacement, it throws an exception! If ...
Is there an easy way to sort an NSMutableArray of NSMutableArrays containing NSStrings?
I am sure that there must be an easy method for doing this but I can't seem to find it.
To Clarify I want to sort the first array alphabetically by the NSString at index 3 of the sub array.
...
Ok, I have some C# code that looks like this and I was wondering what other developers would recommend if I am trying to put this into Objective-C.
List<List<string>> meta_data
I'm planning on using NSMutableArray but how to exactly get that two-dimensional array figured out is my problem, since there is no such thing as a multidimens...
I am trying to get an array from a plist as suggested on an answer here but it's not working. Can someone tell me what I'm missing?
Here is what the plist looks like....another weird thing is that I can't get this to open in a plain text file?? when I do it looks like garbage.....but it looks fine in the property list editor:
<?xml ver...
Ok, if you take a look at my two previous posts (Link #2 in particular), I would like to ask an additional question pertaining to the same code. In a method declaration, I am wanting to define one of the parameters as a pointer to an array of pointers, which point to feat_data. I'm sort of at a loss of where to go and what to do except t...
I have two arrays in Objective C and I need to find what index something is so I can insert it in the same place. For instance, lets say I have a "name array" and an "age array". How do I find out what index "charlie" is in the "name array" so I know where to insert his age in the "age" array?
Thanks
...
I was wondering if there is any sample code out there for objective-C for implementing a NSMutableArray of type struct. Inside, I need there to be 2 mutable arrays (via NSMutableArray also) declared in the struct. All the code samples in my book show me how to make an array of defined size via C array syntax (with the brackets), but I do...
I've found this snippet of code on the net. It sets up an NSMutableArray in a way I've not seen before ( I'm an Obj-C newb). Can someone explain what it's doing and why you would do it this way? Particularly the @syncronized, static and little plus sign on the method signature.
add the following to the .h file:
+(NSMutableArray *)allMyS...
An iPhone question for you guys! I have an NSURLConnection that downloads XML from a server and processes it into an array which is a part of another array. I have no way of knowing how many objects I will need, so I cannot allocate an NSArray beforehand. My question is:
Would it be better to create the parent array as an NSArray at the...
I am creating an array of dictionaries in a class. I want to return a copy of that array to any other object that asks for it. This copy that is passed to other objects needs to be modified without modifying the original.
So I am using the following in a getter method of my class that holds the "master" array:
[[NSMutableArray alloc] i...
What's the difference?
In my context, I need to be able to dynamically add to and remove objects. The user clicks on rows of a table that check on and off and thus add or remove the referenced object from the list.
A wild guess is that array has indexed items while set has no indexes?
...
I have the error -[NSCFString stringValue]: unrecognized selector sent to instance 0x1578c when executing this code
I don't understand what I'm doing wrong
name is a NSString
self.searchValues= [[NSMutableArray alloc] init];
name=@"Bob";
if(self.name!=nil)
[searchValues addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys:@"N...
Hi
Is it possible to take 2 NSDictionaries and populate 1 NSMutableArray?
So lets say I have this situation:
dict1 = key/value of:
id/firstname
dict2 = key/value of:
id/lastname
(These are populated from a database query to the server)
Now, I want to combine the dictionaries into an NSMutableArray of "user" objects. the user object ...
Hi guys,
I'm pretty new to objective-c and try to create a small app for the iphone.
I'm nearly done beside this little error here. Actually, I've searched hours with google to find a proper solution but unfortunately I'm not able to find a solution which works.
I'm using this tutorial here to build up an UITableView: UITableView Tutori...
// Add the button to the NSMutableArray.
...
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[[self hBtns] addObject:btn];
...
// In another method, try to see if it exists.
- (void)didPushBtn:(id)sender
{
UIButton *btn = (UIButton *)sender;
if ([[self hBtns] containsObject:btn]) // Is false every time.
...
}
Why i...
Hi, I'm trying to build a nested array: First, I make a "PlayerItems" array which will contain 10 arrays, each containing item objects, corresponding to the inventories of each player in the game. On the indicated line, I get the following error:
error: void valued not ignored as it ought to be
What is the void value here? If I use...
Hi, I'm trying to make an object in one array equal to another. If I set each property individually, it works fine, but I want to set one object equal to antoher without writing a function to run through each property.
-(void)DrawCard: (int) wp{
[self GetNc :(wp)];
if (nc > 0){
((card*) [[Hands objectAtIndex:wp] objectAtIndex:nc]) = (...
When I get a memory warning I am releasing a bunch of objects stored in an NSMutableArray.
[_children release];
I also need to recurse through objects at some point (potentially after a mem warning has happened), so I need to check if the objects are still around, which I do with comparison to nil- which isn't going to work because re...
I have a synthesized NSMutableArray - theResultArray . I want to insert NSNumber or NSInteger objects at specific indexes (0-49). For some reason I can never get any values to stick in my array. Every index returns nil or 0.
NSInteger timeNum = time;
[theResultArray insertObject:[NSNumber numberWithInt:timeNum] atIndex:rightIn...
Hi
I currently try to fill and NSMutableArray with something like this:
deck = [[NSMutableArray alloc] initWithCapacity:52];
for (int suit = 0; suit <= 3; suit++) {
for (int value = 1; value <= 13; value++) {
ANormalCard *card = [[ANormalCard alloc] initWithSuit:suit value:value];
[deck addObject:card];
[card autorelease...