开发者

How do you reset real number count?

开发者 https://www.devze.com 2023-04-01 03:17 出处:网络
This is simple code for add number. I press 10 times. - (IBAction)Button1 { NSString *numValue = [[NSString alloc] initWithFormat:@\"%d\", count++];

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";

}
0

精彩评论

暂无评论...
验证码 换一张
取 消