2017-06-30 7 views
-1

GIFファイルをUIImageviewに統合します。それは私のためにうまく動作しますが、無限の時間が実行されます。私は特定の時間やサイクルでGIFを停止したいGIFiOSアプリケーションでGIFを停止するにはどうすればよいですか?

+0

あなたImageViewのを設定する必要がありますか? – KKRocks

+0

@KKRocks、はいSwiftGifサードパーティライブラリを使用 – Hemanshu

+0

コードを追加して、GIFをUIImageViewに設定する方法は? – Venkat

答えて

2

ここに述べたように、あなたがGIFのためのライブラリを使用しました

https://github.com/bahlo/SwiftGif/wiki/Extended-use

let jeremyGif = UIImage.gifWithName("jeremy") 

let imageView = UIImageView(...) 
// Uncomment the next line to prevent stretching the image 
// imageView.contentMode = .ScaleAspectFit 
// Uncomment the next line to set a gray color. 
// You can also set a default image which get's displayed 
// after the animation 
// imageView.backgroundColor = UIColor.grayColor() 

// Set the images from the UIImage 
imageView.animationImages = jeremyGif?.images 
// Set the duration of the UIImage 
imageView.animationDuration = jeremyGif!.duration 
// Set the repetitioncount 
imageView.animationRepeatCount = 1 
// Start the animation 
imageView.startAnimating() 
+0

私のために働いてくれてありがとう – Hemanshu

関連する問題