我创建了一个计数动画,现在我想创建一个包含我的标签文本值的整数,就像这样:如果我的标签显示数字,那么我的整数将等于 1,依此类推.. 我该怎么做? 这是我的代码:
-(void)countup
{
count = 1;
MainInt += 1;
numbersLabel.text = [NSString stringWithFormat:@"%i", MainInt];
NSLog(@"%d", count);
}
-(void)viewdidload
{
[numbersLabel setOutlineColor:[UIColor whiteColor]];
[numbersLabel setGradientColor:[UIColor blackColor]];
numbersLabel.drawOutline = YES;
numbersLabel.drawDoubleOutline = YES;
numbersLabel.text = @"start";
//numbersLabel.font = [UIFont fontWithName:@"Ballpark" size:220];
numbersLabel.font = [UIFont fontWithName:@"Arial" size:220];
MainInt = 1;
numbersTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(countup) userInfo:nil repeats:YES];
}
谢谢!