我創建了一個計數動畫,現在我想創建一個包含我的標籤文本值的整數,如下所示:如果我的標籤顯示數字,那麼我的整數將等於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];
}
謝謝!
不能完全肯定還是你找什麼做的?您顯示的代碼已經使用計時器和計數器例程計數了,您還想要做什麼? – trumpetlicks