1
let profile_pic_url_hd = user["profile_pic_url_hd"] as! String
self.imgURL = "\(profile_pic_url_hd)"
self.imgURL
是一個鏈接,它是一個字符串。該鏈接,例如:更改包含鏈接的字符串
https://scontent-frx5-1.cdninstagram.com/t51.2885-19/s320x320/19121160_1328742810566926_6482637033138290688_a.jpg
有誰知道如何此鏈接更改爲:
https://scontent-frx5-1.cdninstagram.com/t51.2885-19/19121160_1328742810566926_6482637033138290688_a.jpg
換句話說,沒有/s320x320/
。
你爲什麼要指定' 「\(profile_pic_url_hd)」''來代替self.imgURL'直接分配'profile_pic_url_hd'? – rmaddy
'profile_pic_url_hd'是Json類的名稱或任何它叫 –
不,它不是。它是'String'類型的變量。只要做:'self.imgURL = profile_pic_url_hd' – rmaddy