UIImageViews in NSMutable Arrays

I am in the process of making the game Avalanche for the iPod family. I have my random objects appearing at the top and dropping down with a set of lines that go like this :

[UIView setAnimationsDidStopSelector:@Selector(onAnimationComplete:finished:context:)]; [UIView setAnimationDelegate:self]; [UIView commitAnimations];

I have also created a UIImageView like so:

UIImageview* debrisView= [[UIImageView alloc] initWithImage: debris];

I want to put the debrisView in a array and iterate through to see the frame (or coordinates). I want to be able to compare the coordinates to where the player is to see if they touch and what not (therefore the game is over). How would I add multiple (more than 500) "debrisView" to an array, compare the frame within the array to a moveable UIImageView.. say named player to see if the coordinates of the falling debris are a match or touching with the player? And as far as memory goes, how do I get rid of "debrisView" in my array when the object touches the bottom screen? Could somebody please point me in the right direction or even explain this all to me? I am really new to Objective - C. Much appreciated. Thanks in advance!


-------------Problems Reply------------

As far as memory goes, you probably shouldn't be using UIKit for this. Cocos2d is better for games, and you can use Box2d or chipmunk for physics.

Category:iphone Views:1 Time:2011-04-29

Related post

  • giving nil while accessing the nsmutable array 2010-11-10

    i am parsing a json object and storing the song objects in songs, a nsmutable array. while am displaying the image of the song i.e. while accessing the object from the array its giving all values nil in that object. in the following code in setSongsS

  • iPhone SDK: How to copy the contents of a NSArray to NSMutable array? 2010-02-05

    I need to copy the contents of an NSArray to NSMutable array. In other words, I want to copy arrayCountryChoices to arraySearchResults. Any ideas???? //main data NSArray *arrayCountryChoices; //search results buffer NSMutableArray *arraySearchResults

  • When I am replacing or inserting an object into nsmutable array, I am getting an Exception 2010-04-26

    While replacing or inserting into an NSMutable array, I am getting exception as: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable

  • Creating Nsmutable array from xml feed 2010-06-29

    I want to copy items in BlogEntries into my custom Nsmutable Array. The code is -(void) grabRSSFeed:(NSString *)blogAddress { // Initialize the blogEntries MutableArray that we declared in the header blogEntries = [[NSMutableArray alloc] init]; // Co

  • how to search nsmutable array in objective C 2010-07-01

    can any body tell me how to search NSMutable Arry in which objects are stored from xml feed i have the following code - (void) searchTableView { NSString *searchText = searchBar.text; NSMutableArray *searchArray = [[NSMutableArray alloc] init]; //blo

  • UIscroll view images form NSmutable array?? for iphone 2010-07-20

    i tested local images in UIscroll view that worked but now i am doing somethng else i have a string (from xml)having all 10 URLS and then i defined a NSmutable array that holds them now is it possible to extract images from that array and display the

  • how to sort an NSMutable Array reference to date in iphone 2010-07-24

    Hello All I need to sort an NSMutable Array that having a class Objects say Item . Item class have date,url,link,title,guid etc .. I am storing this Object Into an NsMutableArray each time. so MyArray will have number Of Item class Objects .. now I n

  • Global NSMutable array of a project 2010-07-25

    I want to know how i can declare and use a global NSMutable array of an Objective C project. I mean i need to update the here in one class and need to use in another class.... can anyone give me any kind of idea?? Thanks Rony --------------Solutions-

  • Difference between NSArray and NSMutable Array 2010-08-16

    hi am working with NSArrays using foundation tool and i have wrote the following code -(void)simplearrays { NSMutableArray *arr = [NSMutableArray arrayWithCapacity:3]; for(int i =0;i<3;i++) { scanf("%d",&arr[i]); } for(int j =0; j<3;j++) {

  • Size of the NSMutable Array in objective C? 2010-09-24

    I want to ask the size of the NSMutable Array can be 2000? If not, is it possible to open an array to store 2000 elements. The elements is the user-defined object. Thank you. --------------Solutions------------- The answer is that an NSMutableArray a

  • How to remove all objects from a NSMutable Array? 2010-10-04

    I need to remove all objects from a NSMutable Array. I can't seem to do this by enumerating as the code crashes. Can anyone tell me the best way to do this with code example if possible ? Many thanks, Martin --------------Solutions------------- This

  • NSMutable Array and brain damage 2010-10-29

    I have understandably attracted some smart ass answers to some bone head questions I have asked lately due to my complete misunderstanding of obj c and NSMutable arrays. So I've looked in a book I have and Google and it would appear that may be I sho

  • Objective C, How to store data in NSMutable Array 2011-03-05

    I have a class has 4 NSString variables and 1 UIImage variable. Also I have NSMutable Array that holding several instances of the class. I want to store the data in NSMutalbe array into somewhere in iPhone. What is the best way for this? ------------

  • NsMutable Array problem 2011-03-09

    when i remove object from nsmutable array it shows exception but some time it works [Array removeObjectAtIndex:row]; i have use this code Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFArray removeObjec

  • Store NSMutable Array into sqlite database 2011-03-22

    hi i am writng an iphone app and need a bit of help.. i have this uitableview which displays data that is contained in a nsmutable array.. this data is retrieved via some operations therefore amount of data is not the same every time... what i want t

  • iOS making a 2D array using NSMutable array 2011-04-19

    I want to make a 2D array like this [[1,2,3],[94,22],[2,4,6],[1,3,5,6]] What is the best way to do this for iOS using NSMutable arrays --------------Solutions------------- You cannot create a static 2D array with differently sized rows. Perhaps you c

  • How to sort NSMutable array in ascending order 2011-05-06

    How to sort NSMutable array in ascending order. Can any one help me out this. --------------Solutions------------- You haven't said what's in your array, but if it's something that responds to -compare: then you can use [myArray sortUsingSelector:@se

  • How to determine the index number of the last object in a NSMutable Array 2011-05-06

    I have a NSMutable Array and was trying to find the index number of the last object in this array. I tried this, but it feels cumbersome: int currentCount = [[[self.myLibrary objectAtIndex:currentNoteBookNumber] tabColours] count]; NSLog(@"Number of

  • How to copy TableView cell data to a NSMutable Array? 2011-06-29

    I'm quite new to iphone development. I created To-Do List app using coredata. so, my table view dynamically updating. I want to add table view row textlabels to a NSMutable array (that means row1 text label to 1st index position of MutableArray , row

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.125 (s). 11 q(s)