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 Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-11-2009, 06:23 AM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 4
Default How to make the button clickable during animation?

Now I've gotten myself stuck into a hole with this problem, and due to my lack of experience, I can't seem to figure out what the issue is.

I've created a dynamic UIButton and set it to the view, which is completely clickable when it's not moving on the screen. However, when I animate the button as a UIView, the button is no longer clickable.

Am I doing something wrong? How can I make it so that the button is moving from one place to another place on the screen and yet have it clickable?

Here is my code:
Code:
UIImage *dotImage = [UIImage imageNamed:@"noteBassImage.png"];
CGRect btnDot = CGRectMake(41, 41, dotImage.size.width, dotImage.size.height);

UIButton *dotButton = [[[UIButton alloc] initWithFrame: btnDot] retain];

dotButton.frame = CGRectMake(139, 0, 41, 41);
dotButton.alpha = 1.0;

[dotButton setBackgroundImage:dotImage forState:UIControlStateNormal];
[dotButton addTarget:self action:@selector(onPressBass) forControlEvents:UIControlEventTouchDown];
[dotButton setEnabled:YES];

[dotImage release];

[self.view addSubview:dotButton];

// button is clickable until here

[UIView beginAnimations:nil context:dotButton];
[UIView setAnimationDuration:6];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];

dotButton.frame = CGRectMake(139, 500.0, 41, 41);

[UIView setAnimationDidStopSelector:@selector(onAnimationComplete:finished:context:)];
[UIView setAnimationDelegate:self];
[UIView commitAnimations];
iconsam is offline   Reply With Quote
Old 12-12-2009, 12:25 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 4
Default

So after doing some research and getting advice from a LIVEPERSON. Yes, the dude actually knew their stuff. I found out that it's not possible to click on a button that's doing an animation via UIView.

Here's a better explanation of what's happening:
https://devforums.apple.com/message/5384#5384
iconsam is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, uibutton, uiview

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: 257
21 members and 236 guests
14DEV, @sandris, ADY, ArtieFufkin10, bookesp, ckgni, dacapo, Dani77, DarkAn, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, prchn4christ, Rudy, ryantcb, Speed, 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 02:46 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0