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

View Single Post
Old 02-13-2009, 01:44 PM   #1 (permalink)
AcousticBlue
New Member
 
Join Date: Feb 2009
Posts: 1
Default UIBarButtonItem not responding to touch

I am doing some real basic animation using an NSTimer - it works great. However, I have since tried to have a button update it's title based on whether the animation is on or off and to reset/kill the timer based on the same. (The button is part of a UIToolbar)...

Here is my code:

- (IBAction)startid)sender
{
UIBarButtonItem *button = (UIBarButtonItem *)sender;
NSString *title = (timer!=nil) ? @"Start" : @"Stop";
if (timer!=nil)
{
[timer invalidate];
[timer release];
timer = nil;
} else {
timer = [NSTimer scheduledTimerWithTimeInterval:0.025 target:self selector:@selector(tick) userInfo:nil repeats:YES];
}
[button setTitle:title];
}

This works great in the simulator. However, on the actual device, it works the first time you touch the start button. However, when you then try to stop it, the button no longer responds to a user touch. I am at a complete loss. Does the UIBarButtonItem change its respondToEvents status when it's title is changed? I would think this would also effect the simulator. The only other thing I can think of is that I am not releasing the NSTimer properly for the device to respond correctly. Can anyone help?

Thanks,
Charles
AcousticBlue is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,560
Threads: 89,129
Posts: 380,270
Top Poster: BrianSlick (7,105)
Welcome to our newest member, jane
Powered by vBadvanced CMPS v3.1.0

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