- Fix reused bug with UITableViewCell or UICollectionViewCell
- Loading web image with view animation
- Smooth loading web image
- Drag the UIImageView to your storyboard and set it to
WebImageView.swift
- Load Image form URL๏ผ
yourImageView.load(fromURLString: webUrlString, enableAnimation: true, defaultImage: UIImage(named: "defaultImage")!)
- You can set animation transition style with
animationOptions:
yourImageView.load(fromURLString: webUrlString, enableAnimation: true, defaultImage: UIImage(named: "defaultImage")!, animationOptions: .transitionCrossDissolve)
Check out animationOptions with UIViewAnimationOptions documents.
-
Or just set
enableAnimation: false
to load without animations. -
Cancel download tasks for table view
didEndDisplaying
:
func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) {
guard let imageCell = cell as? ImageTableViewCell else {return}
imageCell.imageView.cancelLoading()
}
- Swift 3
- iOS 10
Drag WebImageView.swift
and InternetUtil.swift
to your XCode project.
Contact me with with email or linkedin
- Please ๐ this repo if you like it!