08-23-2009, 06:02 PM
#1 (permalink )
Registered Member
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
How do I make it to where 2 UIImageViews touch a UIAlertView pops up ?
Hi ! I am trying to make it where a falling object with this animation code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationRepeatCount:0];
myBalloon.center = moveRight.center;
[UIView commitAnimations];
This code makes the UIImageView go from one image to another. I have it where another code moves from left to right. I did this code to try and make it where if the 2 ImageViews touch an alertview would pop up but it doesn't work. Here is the code.
if (CGRectIntersectsRect(myNail.frame, myBalloon.frame)) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"hit!" message:@"yeah man!" delegate:self cancelButtonTitle:@"dismiss" otherButtonTitles:nil];
[alert show];
[alert release];
}
Its just not working and I tried it on a different project like when it doesn't move just one view from another and it just doesn't wanna work. Can anyone help ? Please and thank you.
08-23-2009, 09:44 PM
#2 (permalink )
Beast Iphone Developor
Join Date: Aug 2009
Location: Atlanta, Georgia
Age: 16
Posts: 1,302
Quote:
Originally Posted by
AppStoreMod
Hi ! I am trying to make it where a falling object with this animation code:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationRepeatCount:0];
myBalloon.center = moveRight.center;
[UIView commitAnimations];
This code makes the UIImageView go from one image to another. I have it where another code moves from left to right. I did this code to try and make it where if the 2 ImageViews touch an alertview would pop up but it doesn't work. Here is the code.
if (CGRectIntersectsRect(myNail.frame, myBalloon.frame)) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"hit!" message:@"yeah man!" delegate:self cancelButtonTitle:@"dismiss" otherButtonTitles:nil];
[alert show];
[alert release];
}
Its just not working and I tried it on a different project like when it doesn't move just one view from another and it just doesn't wanna work. Can anyone help ? Please and thank you.
Are you geting any errors or warnings?
08-23-2009, 09:46 PM
#3 (permalink )
Registered Member
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Quote:
Originally Posted by
justill45
Are you geting any errors or warnings?
No. IDK what is with this.
08-23-2009, 09:53 PM
#4 (permalink )
Beast Iphone Developor
Join Date: Aug 2009
Location: Atlanta, Georgia
Age: 16
Posts: 1,302
wow, i cant find anything wrong with ure code.......sry, ill keep looking though
08-26-2009, 07:14 AM
#5 (permalink )
Registered Member
Join Date: Aug 2009
Posts: 216
Try if (CGRectContainsRect (myNail.frame, myBalloon.frame))
08-26-2009, 10:39 AM
#6 (permalink )
Registered Member
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Quote:
Originally Posted by
johnathon
Try if (CGRectContainsRect (myNail.frame, myBalloon.frame))
Nope didn't work. Someone told me because I am using this animation code its not gonna work. Do you think its true ?
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:7.5];
[UIView setAnimationRepeatCount:10];
myNail.center = myNailFinished.center;
[UIView commitAnimations];
They said use an NSTimer but I do and nothing ever comes down any more.
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 279
24 members and 255 guests
ADY , AragornSG , Bertrand21 , Dani77 , Dattee , fkmtc , HDshot , HemiMG , iDifferent , jakerocheleau , JasonR , jimbo , macquitzon216 , mer10 , NSeven , prchn4christ , Rudy , sacha1996 , silverwiz , sneaky , spiderguy84 , Sunny46 , theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp