菜鸟教程小白 发表于 2022-12-12 09:07:36

ios - 动画UIImage快捷方式?


                                            <p><p>大家好,第一个问题发布了!</p>

<p>我刚开始使用 Obj-C,我正在制作我的第一个动画。我的动画由 60 张 2 秒的图像组成,但我发现在我的代码中说明每一个图像有点乏味。</p>

<pre><code> self.backgroundImageView.animationImages = initWithObjects:
    ,
    ,
    ,
    ,
    ,
    ,
    ,
    ,
    ,
    ,
    ....
    ,
</code></pre>

<p>这有什么捷径吗?!?!?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><pre><code>for (NSInteger i = 1; i &lt; 61; i++) {
    NSString *imageName = ;
    //init your image with the name here.
    //...
}
</code></pre>

<p><code>%ld</code>和<code>05</code>的格式整数表示格式字符串的宽度为5,如果长度小于5,则插入前导0。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 动画UIImage快捷方式?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/22844817/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/22844817/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 动画UIImage快捷方式?