我是Xcode的新手,我真的陷入了困境。
我有一个UIProgressView,它填满了UISwipeGestureRecognizer。我也有一个switch语句。现在我想只有7种方法(从242开始)而progressTrue是假的。如果progressTrue为true,那么UIProgressView在1.0上,它应该随机选择新的7个案例。有可能吗?
感谢您的帮助!
-(void)vorgangDev {
int number = arc4random() % 242;
switch (number) {
case 0:
question.text = @"Anlieferung/anliefern";
answer.text = @"delivery, supply/deliver, supply";
answer.hidden = YES;
break;
case 1:
question.text = @"Artikel";
answer.text = @"article, item";
answer.hidden = YES;
break;
case 2:
question.text = @"Artikelanzahl";
answer.text = @"number of articles/ ~items";
answer.hidden = YES;
break;
//And so on...
}
我在这里打电话给vorgangDev。
if (progressTrue.progress == 1.0) {
// The UIProgressView is full
// if this is true do the question.
CABasicAnimation* fade = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
fade.fromValue = (id)[UIColor blackColor].CGColor;
fade.toValue = (id)[UIColor colorWithRed:50/255.0f green:109/255.0f blue:43/255.0f alpha:1.0f].CGColor;
[fade setDuration:1];
[self.view.layer addAnimation:fade forKey:@"fadeAnimation"];
progressTrue.progress = 0.0;
[self vorgangDev];