上次丢代码的时候,把这一段也丢了,由于扒这方面的资料很少有符合条件的,花了点时间才实现的,其中最主要的方法想不起来了,其实代码还是很简单的,好了,开始上代码:
-(void)addLoadLabel
{
UILabel* loadLabel = [[UILabel alloc]initWithFrame:sender.superview.bounds];
loadLabel.textColor=Root_Color;
loadLabel.font= [UIFont boldSystemFontOfSize:20];
loadLabel.textAlignment=NSTextAlignmentCenter;
[self .view addSubview:loadLabel];
self.loadNeedLabel= loadLabel;
for(inti =1; i <= loadStr.length; i++) {
NSString* originLoadStr = [loadStr substringToIndex:i];
[_loadArray addObject:originLoadStr];
}
NSTimer* timer= [NSTimer timerWithTimeInterval:0.5 repeats:YES block:^(NSTimer* timer) {
[self performSelector:@selector(delayForLoadLable) withObject:nil afterDelay:0];
}];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] run];
}
}
static int num =0;
-(void)delayForLoadLable
{
if(num<_loadArray.count) {
self.loadNeedLabel.text=_loadArray[num];
num++ ;
}else
{
num=0;
self.loadNeedLabel.text=_loadArray[num];
}
}