Skip to content

Commit

Permalink
add image broken,when set local image fail
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminlinux committed Aug 28, 2018
1 parent 4b2330b commit 947dc0e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ public class IMUIImageMessageContentView: UIView, IMUIMessageContentViewProtocol
}

public func layoutContentView(message: IMUIMessageModelProtocol) {
imageView.image = nil // reset image

imageView.frame = CGRect(origin: CGPoint.zero, size: message.layout.bubbleContentSize)
imageView.image = UIImage(contentsOfFile: message.mediaFilePath())
if imageView.image == nil && (message.webImageUrl?() == nil || message.webImageUrl?() == "") {
self.imageView.image = UIImage.imuiImage(with: "image-broken")
}

task?.suspend()
self.urlString = message.webImageUrl?() ?? ""
task = IMUIWebImageTaskManager.shared.downloadImage(self.urlString!) { (data, precent, urlString, error) in
if (error != nil) {
print("\(String(describing: error))")
return
}

Expand Down

0 comments on commit 947dc0e

Please sign in to comment.