在UILabel中显示NSTimer计数

时间:2013-03-16 18:41:03

标签: objective-c xcode4 nsstring int

我想显示我的倒计时加载过程,并了解使用ARCint转换为NSString是不允许的。如何在count中显示我的NSString

static int count = 0;
count++;

NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:(5.0) 
                          target:self 
                          selector:@selector(uploadData) 
                          userInfo:nil 
                          repeats:NO];

if (count <= 5)
{
    ilabel.text = @"Please be patient...";
    NSString *counter = count;
    counterLabel.text = counter;
}

2 个答案:

答案 0 :(得分:2)

最简单的方法可能是:

NSString* counter = [NSString stringWithFormat: @"%d", count];

答案 1 :(得分:1)

counterLabel.text = [NSString stringWithFormat:@"%d",count];