- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一些看法,想一一展示。我找不到如何做到这一点。相反,如果我使用以下代码,所有 View 都会立即出现。
NSTimer *timer1 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar2) userInfo:nil repeats:NO];
NSTimer *timer2 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar3) userInfo:nil repeats:NO];
NSTimer *timer3 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar4) userInfo:nil repeats:NO];
NSTimer *timer4 = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar5) userInfo:nil repeats:NO];
[timer1 fire];
[timer2 fire];
[timer3 fire];
[timer4 fire];
-(void)showStar2
{
[UIView beginAnimations:@"anim1" context:NULL];
[UIView setAnimationDuration:0.5];
[stars[1] setAlpha:1];
[UIView commitAnimations];
}
除了行之外,所有 showStar 函数都是相同的
[UIView beginAnimations:@"anim1" context:NULL];
[stars[1] setAlpha:1];
有不同的论点。 stars
是 UIImageView
的数组。欢迎提出任何建议。
最佳答案
实际上,您恰好在 2 秒后触发所有计时器。更改不同计时器的时间间隔。
相反,您可以使用将重复触发的单个 NSTimer
。
在 .h 文件中声明 NSUInteger count;
。
按如下方式启动一个 NSTimer:
[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(showStar:) userInfo:nil repeats:YES];
您的showStar
方法应该如下所示:
-(void)showStar:(NSTimer*)timer
{
if( count > 0 )
{
[stars[count-1] setAlpha:0];
}
[UIView beginAnimations:@"anim1" context:NULL];
[UIView setAnimationDuration:0.5];
[stars[count] setAlpha:1];
[UIView commitAnimations];
count++;
if( count == 4 )
{
[timer invalidate];
count = 0;
}
}
已添加以下代码。
if( count > 0 )
{
[stars[count-1] setAlpha:0];
}
关于ios动画一一,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9158816/
我想为我指定的每个类别 ID 检索最新帖子的 mongo 选择器。 这是 forumTopics 集合中对象的示例: { _id: ..., createdTime: [unix ep
我正在尝试一个接一个地运行两个ajax 请求。所以,我可以使用 ajax success() 函数: $.ajax({ ... success: function() {
这是我的 Codepen 链接:resizable event 我正在使用可调整大小的 Jquery UI,一切正常,但现在我希望每个 block 上的可调整大小事件只能一个接一个地激活,如果单击另一
我在 Kotlin 上使用 MongoDB 和 Spring,我希望我的应用程序在启动时填充 MongoDB 集合。 (并在每次启动时清洁它) 我的问题是,如果我正在填充的某些数据有问题,我该如何一一
我有一些元素的列表,我想要一个接一个的 fadeIn 元素,意味着如果第一个元素完成 fadeIn 然后下一个元素 fadeIn 等等,在我给定的代码中我不知道出了什么问题,请帮助我.. HTML A
正如很多地方所说,对于大小为 10000 的输入数据,批量预测整个数据比逐行预测要快得多(在这两种情况下,model.n_jobs=1)。 我知道一对一的解决方案有很多开销。但是在在线服务中,请求是一
我在使用 5 个 div 元素使其响应时遇到了问题。 我有这样的 div 元素: Here Image 1 Here Image 2 Here
我是一名优秀的程序员,十分优秀!