我实现了我的程序如下。
- (IBAction) toolbarOption:(UIBarButtonItem *)sender
{
switch ([sender tag]) {
case 0:
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
break;
case 1:
for (int i=0; i< [array count]; i++)
{
label02.hidden = YES;
label03.hidden = YES;
label01.text = [array objectAtIndex:i];
order.text = [NSString stringWithFormat:@"%i of %i", i+1,[array count]];
NSDictionary *pronunciation = [[SingletonHandle getHandle] getPronunciationPlist];
label02.text = [pronunciation objectForKey:label01.text];
label03.textColor = [UIColor redColor];
label03.text = [meaning objectForKey:label01.text];
[self performSelector:@selector(showButton:) withObject:nil afterDelay:2.0];
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:nil selector:@selector(showButton:) userInfo:pronunciation repeats:NO];
[timer fire];
}
break;
default:
break;
}
-(IBAction)showButton:(id)sender
{
label02.hidden = NO;
label03.hidden = NO;
nextButton.hidden = NO;
previousButton.hidden = NO;
order.hidden = NO;
}
...
我想显示label.text
int i 随着时间延迟而变化,但它不起作用。它只是向我展示了最后一个label.text
. 我想label.text
使用NSTimer
. 先感谢您。