hello everyone,
I'm a new "developer" trying to build some iPhone app
I'm making an app which gets text from a list of objects in a NSArray and then randomizes them and display one in a TextView, here's the code:
- (IBAction)azione{
NSArray *myArray= [NSArray arrayWithObjects: @"Pasta",@"Pizza",@"Wait",@"Go", nil];
int length = [myArra...
Hi,
i like to create an artwork counter- display on an iphone, diplaying 0 to 9. The 10 digits are 10 png- files with the numbers 0 to 9 as their artwork content. The 10 png- files are implemented by using NSArray. Following you'll find the implementation- code:
zahlenArray = [NSArray arrayWithObjects:
[UIImage imageNamed:@"...
Hello,
in my current project I'm facing the following problem:
The app needs to exchange data with my server, which are stored inside a NSMutableArray on the iPhone. The array holds NSString, NSData and CGPoint values.
Now, I thought the easiest way to achieve this, was to convert the array into a properly formatted string, send it t...
I believe my problem involves pointers, a concept I often struggle with, but here's what I'm trying to do.
I have six NSArrays. I want an additional NSArray comprised of these six arrays, so:
self.arr1 = [NSArray array];
self.arr2 = [NSArray array];
self.arr3 = [NSArray array];
self.arr4 = [NSArray array];
self.arr5 = [NSArray array];
...
Hello,
I have an NSArray called 'objects' below with arrayCount = 1000. It takes about 10 secs to iterate through this array. Does anyone have a faster method of iterating through this array?
Thanks!
for (int i = 0; i <= arrayCount; i++) {
event.latitude = [[[objects valueForKey:@"CLatitude"] objectAtIndex:i] floatValue];
event.lon...
I have a UINavigationController consisting of a tableview I want to load some data into.
I have a dictionary plist containing Dictionaries for each Train Line which in turn have dictionaries for each station with the relevant information along with one string lineName. I need to collect the station Names keys and add them to an array to...
Is there a way construct a predicate to filter by class type?
I currently loop through the array and check to the class of each object. Maybe there is a cleaner way?
...
I used,
for(id value in values) to get the value from an NSArray. Now I want to store it in 2 dimensional float array[][]. When I try to assign the values to array it is giving error:incompatible types in assignment.
I tried to cast the value but I got error: pointer value used where a floating point value was expected. I need to stor...
Hi,
I've been spending the last few hours trying to find the memory leak in my code. Here it is:
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
expression = [expression stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // expression is an NSString object.
NSArray *argument...
I have a class Song with properties Title, Key, Artist, etc. There are no methods. I loop through a database of song information and create a Song object for each, populating the properties, and then store the Song objects in an NSArray.
Then I thought, why not just have a struct Song with all those same properties instead of a class So...
I've populated and array with data like this in one class...
PowerClass.h
NSMutableArray pickerArray;
@property (nonatomic, retain) NSMutableArray pickerArray;
-
PowerClass.m
@synthesize pickerArray;
@implementation
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"stef", @"steve", @"baddamans", @"jonny", nil];
pickerArr...
I know you shouldn't use this to decide whether or not to change an array:
if ([possiblyMutable isKindOfClass:[NSMutableArray class]])
But say I'm writing a method and need to return either an NSMutableArray or an NSArray, depending on the mutability of possiblyMutable. The class using my method already knows whether or not it's accep...
Hi, I have the following problem and I cannot figure out how to solve it. I have an NSSet which contains Person objects (NSDictionary with 2 keys: name, age). From time to time I get an NSArray of Person objects and I want to add them to my NSSet but I want to filter out the duplicates. I'm thinking I could use NSPredicates but I am read...
I have created 5 NSDictionary's. I stored them in NSArray. I need to get the values stored in NSDictionaries. How can do it ?
I tried calling [[array objectAtIndex:i]objectForKey:key1].
But, it is crashing by giving the message:unrecognized selector sent to instance
How to get the data ?
NSDictionary *enemy1, *enemy2;
NSArray *enemyDat...
Hello!
Is there a way to create two dimensional NSArray without nesting arrays in the primitive format aFloatArray[][].
Thank you.
...
I've seen examples of something like
[someArray sortUsingSelector:@selector(compare:)];
I'm looking for an example that stores a collection of UIViews and I'd like to sort them in ascending or descending order based on tags I assume programatically when a new UIView is created.
If someone could provide a code example or instructions ...
I am trying to code a global lookup table of sorts.
I have game data that is stored in character/string format in a plist, but which needs to be in integer/id format when it is loaded.
For instance, in the level data file, a "p" means player. In the game code a player is represented as the integer 1. This let's me do some bitwise ope...
Hi..
How do i go about seeing if my integer is in an array of integers...
eg i want to know if 7 is in an array of [ 1 3 4 5 6 7 8]
any ideas?
Thanks
...
If I try and release tempSeedsArray after seedsArray = tempSeedsArray , I get an EXEC_BAD_ACCESS, and Instruments shows that tempSeedsArray has been released twice. Here is my viewWillAppear method:
- (void)viewWillAppear:(BOOL)animated {
NSString *arrayFilePath = [[NSBundle mainBundle] pathForResource:@"SeedsArray" ofType:@"pli...
Example:
I have an NSArray with 40 objects. What is the most efficient way to return ONLY those objects with index equal to a number specified in another NSArray (e.g {0, 27, 36} for example)?
Can a predicate be used here? Or is there a more simple and efficient approach?
...