Hi,
I'm trying to change a UILabel's text on the event touchesEnded.
Here's my code:
Code:
- (void) setInstructions:(NSString *)text
{
[instructions performSelectorOnMainThread:@selector(setText:) withObject:text waitUntilDone:YES];
}
...
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
NSLog(@"Touches ended");
UITouch *touch = [touches anyObject];
touchPoint = [touch locationInView:self];
originalPoint = touchPoint;
[self setInstructions:@"Next step reached."];
drawingState++;
fprintf(stderr, "%s", instructions.text);
[location removeFromSuperview];
location = nil;
}
A previous call to setInstructions: (from initWithFrame:) returns the correct display text, but when I call it from touchesEnded, it doesn't do anything to the UILabel. The log says:
Code:
2011-02-20 20:00:24.823 MyProject[62997:207] Touches ended
(null)
Why is the instructions' text property returning null? And how can I update the UILabel's text?
Thanks!