「Ios/swift/外部ライブラリ/SDWebImage」の版間の差分
ナビゲーションに移動
検索に移動
| 5行目: | 5行目: | ||
==インストール== | ==インストール== | ||
vi Podfile | $ vi Podfile | ||
platform :ios, '9.0' | platform :ios, '9.0' | ||
target 'Helloworld' do | target 'Helloworld' do | ||
2016年6月21日 (火) 09:26時点における版
SDWebImageとは
外部画像取得ライブラリ
非同期取得で、キャッシュ機能などがある。
インストール
$ vi Podfile platform :ios, '9.0' target 'Helloworld' do use_frameworks! pod 'SDWebImage', '~>3.6' end
$ pod install
swfit記述
import SDWebImage
let image1:UIImage? = UIImage(named:"loading.png")
let imageView1 = UIImageView(image:image1)
let imageURL = NSURL(string: "https://www.google.co.jp/logos/doodles/2016/first-day-of-summer-2016-northern-hemisphere-5669295896920064.2-hp.gif")
imageView1.sd_setImageWithURL(imageURL)
imageView1.center = CGPointMake(200, 200)
self.view.addSubview(imageView1)