これを試して。、。
ここで、ラベルのテキストを変更しています..
viewdidload には 1 つのタイマーがあります。,.,
- (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 メソッドが呼び出され、そのメソッドがラベルのテキストを変更します。
私は学んでいます。、。、