【发布时间】:2016-05-25 17:45:29
【问题描述】:
我目前有此功能来检索当前用户图像图像 url,但我想使用用户 ID 而不是 currentUser 怎么做。代码一切正常,但我只想能够在其他用户上使用该功能
func ProfileImage(imageUIView:UIImageView,borderColor:UIColor,borderWidth:CGFloat,backgroundColor:UIColor,noimageLabel:UILabel){
if let user = FIRAuth.auth()?.currentUser{
if user.photoURL == ""{
print("database image is not set")
imageUIView.layer.borderWidth = borderWidth
imageUIView.layer.masksToBounds = false
imageUIView.layer.borderColor = borderColor.CGColor
imageUIView.layer.cornerRadius = imageUIView.frame.height/2
imageUIView.clipsToBounds = true
imageUIView.backgroundColor = backgroundColor
noimageLabel.hidden = false
}else{
imageUIView.layer.borderWidth = borderWidth
imageUIView.layer.masksToBounds = false
imageUIView.layer.borderColor = borderColor.CGColor
imageUIView.layer.cornerRadius = imageUIView.frame.height/2
imageUIView.clipsToBounds = true
imageUIView.backgroundColor = backgroundColor
noimageLabel.hidden = true
var imageUrl = NSData(contentsOfURL: user.photoURL!)
imageUIView.image = UIImage(data: imageUrl!)
}
}
}
【问题讨论】:
标签: ios swift firebase firebase-authentication