Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-23-2009, 06:02 PM   #1 (permalink)
Registered Member
 
AppStoreMod's Avatar
 
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Send a message via Skype™ to AppStoreMod
Default 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.
AppStoreMod is offline   Reply With Quote
Old 08-23-2009, 09:44 PM   #2 (permalink)
Beast Iphone Developor
 
justill45's Avatar
 
Join Date: Aug 2009
Location: Atlanta, Georgia
Age: 16
Posts: 1,302
Default

Quote:
Originally Posted by AppStoreMod View Post
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?
justill45 is offline   Reply With Quote
Old 08-23-2009, 09:46 PM   #3 (permalink)
Registered Member
 
AppStoreMod's Avatar
 
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Send a message via Skype™ to AppStoreMod
Default

Quote:
Originally Posted by justill45 View Post
Are you geting any errors or warnings?
No. IDK what is with this.
AppStoreMod is offline   Reply With Quote
Old 08-23-2009, 09:53 PM   #4 (permalink)
Beast Iphone Developor
 
justill45's Avatar
 
Join Date: Aug 2009
Location: Atlanta, Georgia
Age: 16
Posts: 1,302
Default

wow, i cant find anything wrong with ure code.......sry, ill keep looking though
justill45 is offline   Reply With Quote
Old 08-26-2009, 07:14 AM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 216
Default

Try if (CGRectContainsRect (myNail.frame, myBalloon.frame))
johnathon is offline   Reply With Quote
Old 08-26-2009, 10:39 AM   #6 (permalink)
Registered Member
 
AppStoreMod's Avatar
 
Join Date: Jul 2009
Location: Sacramento,CA
Posts: 90
Send a message via Skype™ to AppStoreMod
Default

Quote:
Originally Posted by johnathon View Post
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.
AppStoreMod is offline   Reply With Quote
Reply

Bookmarks

Tags
alertview, cgrectintersectsrect, game, imageview, touch

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» 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
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:06 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0