How to use this using Storyboard (UIView)
dilipiOSDeveloper opened this issue · 13 comments
how can i use this using storyboard not programmatically, i simply taken a uiview and assigned that view class as "Hola" after that what code i need to change to show my array of images
i m using like this
Hola(frame: CGRect(), imageArray: imageArray, .vertical)
but i m not able to see any image pls help me out
Hey @diliptiwari333 ,
Thanks for reaching out.
I've solved your problem and add a feature for the Hola.
There is the example.
@IBOutlet weak var holaView: Hola!
override func viewDidLoad() {
super.viewDidLoad()
let _image1: UIImage = UIImage(named:"image1")!
let _image2: UIImage = UIImage(named:"image2")!
let _image3: UIImage = UIImage(named:"image3")!
let _image4: UIImage = UIImage(named:"image2")!
let imageArray: [UIImage] = [_image1,_image2,_image3,_image4]
let viewArray: [UIView] = [...........yourViews]
holaView.prepareImagesForStoryboard(uiimageArray: imageArray, rotation: .vertical)
holaView.prepareViewsForStoryboard(viewArray: viewArray, rotation: .horizontal)
}
Use
holaView.prepareImagesForStoryboard(uiimageArray: imageArray, rotation: .vertical)
or
holaView.prepareViewsForStoryboard(viewArray: viewArray, rotation: .horizontal)
depends on which one represents your data.
Hey @diliptiwari333
Are you linked your storyboard UIView into holaView?
Drag & Drop an UIView to Storyboard. Then set it's class to Hola
It must be not linked.
I added it. I worked well for me.
Hey @diliptiwari333 ,
I hope you worked it well.
Go to Hola.swift
and in insertImageElements
function edit UIImageView's
contentMode
as you wish.
look at in line 113.
there is a line with
imageViewArray[i] = UIImageView()
after this line you have to set your content mode like that.
imageViewArray[i]!.contentMode = .scaleAspectFit
etc
Hola is not fully automated, for any changes you have to look at Hola.swift and change its styles or somethings.