Ios UILabel文本在显示文件进度文本时闪烁
我在标签中显示文件传输进度。但是当出现Ios UILabel文本在显示文件进度文本时闪烁,ios,objective-c,nsstring,uilabel,Ios,Objective C,Nsstring,Uilabel,我在标签中显示文件传输进度。但是当出现fileprogress数据字符串时,会根据其位置闪烁directionstring文本。如何停止附加字符串的闪烁 directionstring = @"uploaging file"; fileprogress = transferring rate EX.(25.00 MB of 50.00 MB); message = [message stringByAppendingString:[NSString stringWithFormat:@"%@%@
fileprogress
数据字符串时,会根据其位置闪烁directionstring
文本。如何停止附加字符串的闪烁
directionstring = @"uploaging file";
fileprogress = transferring rate EX.(25.00 MB of 50.00 MB);
message = [message stringByAppendingString:[NSString stringWithFormat:@"%@%@",fileprogress,directionstring]];
progressLabel.text = message;
我做了一个例子(用定时器模拟进度),测试它,文本不闪烁
@implementation ViewController
{
IBOutlet UILabel *_progressLabel;
NSInteger _percent;
}
- (void)showProgress
{
_percent = 0;
[NSTimer scheduledTimerWithTimeInterval:0.2
target:self
selector:@selector(updateProgress:)
userInfo:nil
repeats:YES];
}
- (void)updateProgress:(NSTimer *)timer {
NSString *directionstring = @" uploading file";
NSString *fileprogress = [NSString stringWithFormat:@"%ld of 100", (long)_percent++];
NSString *message = [NSString stringWithFormat:@"%@%@", fileprogress, directionstring];
_progressLabel.text = message;
}
@end
我做了一个例子(用定时器模拟进度),测试它,文本不闪烁
@implementation ViewController
{
IBOutlet UILabel *_progressLabel;
NSInteger _percent;
}
- (void)showProgress
{
_percent = 0;
[NSTimer scheduledTimerWithTimeInterval:0.2
target:self
selector:@selector(updateProgress:)
userInfo:nil
repeats:YES];
}
- (void)updateProgress:(NSTimer *)timer {
NSString *directionstring = @" uploading file";
NSString *fileprogress = [NSString stringWithFormat:@"%ld of 100", (long)_percent++];
NSString *message = [NSString stringWithFormat:@"%@%@", fileprogress, directionstring];
_progressLabel.text = message;
}
@end
您可能正在重新绘制标签@pskyou可能正在重新画标签@psk