###前提・実現したいこと
ここに質問したいことを詳細に書いてください
swiftを使ってカウントダウンタイマーを作ってるのですが、タイマー終了後、自動で画面遷移をした先にアニメーションとアラーム音、アラートを表示させようとしたところ、アラートが一瞬表示されて消えてしまいます。
###発生している問題・エラーメッセージ
エラー等メッセージは発生していませんが、アラート表示が一瞬だけ見えてすぐ消えてしまいます
エラーメッセージ なし ###該当のソースコード import AVFoundation import UIKit import SCLAlertView import FLAnimatedImage class FinishViewController: UIViewController { @IBOutlet weak var TopButton: UIButton! override func viewDidLoad() { super.viewDidLoad() //アラーム音 playsound() // 背景をアニメーションにする let path = NSBundle.mainBundle().pathForResource("アニメーション", ofType: "gif")! let url = NSURL(fileURLWithPath: path) let animatedImage = FLAnimatedImage(animatedGIFData: NSData(contentsOfURL: url)) let backgroundAnimationImage = FLAnimatedImageView() backgroundAnimationImage.animatedImage = animatedImage backgroundAnimationImage.frame = view.bounds view.insertSubview(backgroundAnimationImage, atIndex: 0) // アスペクト比を保ったまま画面端にあわせる backgroundAnimationImage.contentMode = UIViewContentMode.ScaleAspectFit self.view.sendSubviewToBack(backgroundAnimationImage) //アラートを表示 SCLAlertView().showInfo("タイトル", subTitle: "サブタイトル") } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() } //アラーム音 func playsound() { var soundIdRing: SystemSoundID = 0 let soundUrl = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("アラーム", ofType: "mp3")!) AudioServicesCreateSystemSoundID(soundUrl, &soundIdRing) AudioServicesPlaySystemSound(soundIdRing) } }
###試したこと
self.view.bringSubviewToFront()やself.view.sendSubviewToBack()などを試しましたがうまくいきませんでした
###補足情報(言語/FW/ツール等のバージョンなど)
言語 Swift version 2.2
IDE Xcode
Cacao Pods
使用ライブラリ
SCLAlertView
FLAnimatedImage
参考にしたURL
http://swift.swift-studying.com/entry/2015/07/19/202251
http://dev.classmethod.jp/smartphone/ios-swift-sclalertview/
http://tech.eversense.co.jp/207
http://qiita.com/hideji2/items/e7ed482ccffef2c0f66c
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/04/28 23:19