【发布时间】:2017-06-21 22:21:30
【问题描述】:
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? -
profile_pic_url_hd是 Json 类的名称或其他名称 -
不,不是。它是
String类型的变量。就这样做:self.imgURL = profile_pic_url_hd -
如果我按照你的方式做它就行不通了。它按照我的方式工作!