【发布时间】:2012-06-29 12:45:35
【问题描述】:
我创建了一个计数动画,现在我想创建一个包含标签文本值的整数,如下所示:如果我的标签显示数字,那么我的整数将等于 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];
}
谢谢!
【问题讨论】:
-
还不完全确定您要做什么?您显示的代码已经使用计时器和计数例程进行计数,您还想做什么?
标签: objective-c xcode animation uilabel