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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 12-11-2009, 05:23 AM   #1 (permalink)
iconsam
Registered Member
 
Join Date: Dec 2009
Posts: 4
iconsam is on a distinguished road
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
 

» Advertisements
» Online Users: 877
19 members and 858 guests
13dario13, ADY, Ananth, baja_yu, Batman, cgokey, Christioren, djohnson, gogoman, HenryCLacey, latoncefrank, Lily.P, mer10, mkjarred, mwyld, Nobbsy, Prajakta, Saurman, SillyHoney
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,389
Threads: 94,003
Posts: 402,461
Top Poster: BrianSlick (7,978)
Welcome to our newest member, HenryCLacey
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:56 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.