试试这个。,。
在这里,我正在更改标签文本,..,
在 viewdidload 中有一个计时器。,.,
- (void)viewDidLoad
{
label =[[UILabel alloc]initWithFrame:CGRectMake(367, 664, 220, 21)];
[label setText:@"Touch me"];
[label setBackgroundColor:[UIColor redColor]];
[label setTextColor:[UIColor blueColor]];
[self.view addSubview:label];
timer=[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(loadtimer:) userInfo:nil repeats:YES];
}
int k=0;
-(void)loadtimer:(id)sender
{
label.text=(k%2) ? @"Touch me" : @"double tap";
[label setTextColor:( k% 2) ?[UIColor blueColor ]:[UIColor redColor]];
[label setBackgroundColor:( k% 2) ?[UIColor redColor ]:[UIColor blueColor]];
CATransition *transition1 = [CATransition animation];
transition1.duration = 1.0f;
transition1.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition1.type = kCATransitionFade;
[label.layer addAnimation:transition1 forKey:nil];
k++;
}
调用此 Loadtimer 方法。,取决于计时周期。每 5 秒调用 LoadTimer 方法,该方法更改标签的文本,..,
我在学习。,。,