- iOS 9.0 or higher
- Swift 5.0
import BTImageView
Add a custom view to the storyboard and set its class to "BTImageView".
Initialize BTImageView
programmatically
let imageView = BTImageView()
view.addSubView(imageView)
imageView.aligns = [2, 3]
imageView.axis = .vertical
imageView.setImages(images: [
.init(systemName: "1.circle") ?? .init(),
...
.init(systemName: "9.circle") ?? .init(),
])
Result:
imageView.aligns: [1, 2]
imageView.axis = .horizontal
imageView.setImages(images: [
.init(systemName: "1.circle") ?? .init(),
...
.init(systemName: "9.circle") ?? .init(),
])
Result:
imageView.aligns: [2, 3, 2]
imageView.axis = .vertical
imageView.setImages(images: [
.init(systemName: "1.circle") ?? .init(),
...
.init(systemName: "9.circle") ?? .init(),
])
Result:
var imageViews: [UIImaeView] // All UIImageViews in BTImageView. (Default: [])
var images: [UIImage] // All UIImages in BTImageView. (Default: [])
var aligns: [Int] // Item align in BTImageView. (Default: [1])
var axis: NSLayoutConstraint.Axis // ImageViews's direction where its pile up (Default: .horizontal)
var spacing: CGFloat // The spacing of the imageViews. (Default: 5)
var cornerRadius: CGFloat // The ImageView's cornerRadius (Default: 5)
func addImage(image: UIImage)
Add a image with UIImage into the BTImageView
func addImage(url: String)
Add a image with URLstring into the BTImageView
func setImages(images: [UIImage])
Set images with UIImages of the BTImageView
func setImages(urls: [String])
Set images with URLstrings of the BTImageView
func removeFirstImage()
func removeLastImage()
func removeImage(at index: Int)
func removeAllImage()
Remove image from the BTImageViewg
BTImageView is available througb SPM. To install it, simply add the following line to your Package.swift:
// Package.swift
dependencies: [
.package(url: "https://github.com/baekteun/BTImageView", from: "1.1.2")
]
BTImageView is available through CocoaPods. To install it, simply add the following line to your Podfile:
# Podfile
pod 'BTImageView'
baekteun, baegteun@gmail.com
BTImageView is available under the MIT license. See the LICENSE file for more info.