Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 02-13-2009, 12: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
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,318
Threads: 39,113
Posts: 171,503
Top Poster: smasher (2,576)
Welcome to our newest member, lerner274
Powered by vBadvanced CMPS v3.1.0

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