小编Jor*_*rdy的帖子

Swift - 动画 UIImageView 图像

这只是我遇到的一个关于为我当前的应用程序设置设置移动背景图像动画的快速问题。本质上,我想让当前静止的背景图像在我的视图中从左到右无休止地滚动;但我正在努力将它们拼凑在一起。我从各种其他来源编写了这个当前不起作用的函数,而且我真的不知道如何或为什么。

func animate(_ image: UIImageView) {
        UIView.animate(withDuration: 5, delay: 0, options: .curveLinear, animations: {
            image.transform = CGAffineTransform(translationX: -100, y: 0)
        }) { (success: Bool) in
            image.transform = CGAffineTransform.identity
            self.animate(image)
        }
    }
Run Code Online (Sandbox Code Playgroud)

非常感谢任何帮助/协助!

xcode uiimageview ios swift swift3

3
推荐指数
1
解决办法
5915
查看次数

Xcode - 斯威夫特;为启动屏幕添加音效

只是很快就想询问我在尝试在我的快速应用程序的启动屏幕中播放声音效果时遇到的一个小问题。我对于在哪里声明我的 AVAudio 播放器(在我的视图控制器或 Appdelegate 中)感到更加困惑;但两种方法都没有取得成功。这是我目前在 appDelegate 文件中得到的内容

import UIKit
import AVFoundation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var audioPlayer = AVAudioPlayer()

        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            // Override point for customization after application launch.

            self.window = UIWindow(frame: UIScreen.main.bounds)
            self.window!.backgroundColor = UIColor(red: 9/255, green: 4/255, blue: 68/255, alpha: 1)
            self.window!.makeKeyAndVisible()

            // rootViewController from StoryBoard
            let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
            let navigationController = mainStoryboard.instantiateViewController(withIdentifier: "navigationController")
            self.window!.rootViewController = navigationController

            // logo …
Run Code Online (Sandbox Code Playgroud)

xcode launch ios swift swift3

2
推荐指数
1
解决办法
1881
查看次数

标签 统计

ios ×2

swift ×2

swift3 ×2

xcode ×2

launch ×1

uiimageview ×1