This is simple code for add number. I press 10 times.
- (IBAction)Button1 {
NSString *numValue = [[NSString alloc] initWithFormat:@"%d", count++];
counter.text = numValue;
[numValue release];
{
I clicked Reset button and start pressin开发者_C百科g Button1. What happen to Zero?
- (IBAction)Reset {
Counter.text = nil;
}
How do I reset back to real value zero?
How about:
- (IBAction)Reset {
count = 0;
counter.text = @"0";
}
-(IBAction) resetNum
{
//actual variable
count = 0;
//just for cosmetics
Counter.text = @"0";
}
-(IBAction) Reset
{
count = 0;
Counter.text = @"0";
}
精彩评论