如何增加 currentindex 以便 textview 可以按顺序更新而不是随机更新。
- (void)viewDidLoad{
myArray = [[NSMutableArray alloc]initWithObjects:@"String1",@"String2",@"String3",@"String4", @"String5",..... nil];
[NSTimer scheduledTimerWithTimeInterval:2.0
target:self
selector:@selector(updateText:)
userInfo:nil
repeats:NO];
self.textView.font = [UIFont fontWithName:@"Baskerville-Bold" size:22];
self.textView.textAlignment = NSTextAlignmentCenter;
self.textView.backgroundColor = [UIColor clearColor];
self.textView.textAlignment = NSTextAlignmentCenter;
self.textView.text = @"String1";
self.textView.scrollEnabled = NO;
self.textView.editable = NO;
self.textView.userInteractionEnabled = NO;
[baseView addSubview: self.textView];
}
- (void)updateText:(NSTimer *)theTimer {
int index = arc4random() % [myArray count];
myTextView.text = [myArray objectAtIndex:index];
}