eliakorkmaz/Hola

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.

#2

Screen Shot 2019-10-18 at 11 04 26 AM

pls run updated project you created it crashes

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.

I now run ur updated project its working with storyboard only one issue i m facing how can i imageView content size to imageView.contentMode = UIViewContentMode.ScaleAspectFit where this only last help i req.

Simulator Screen Shot - iPhone 6s - 2019-10-19 at 17 49 26
Simulator Screen Shot - iPhone 6s - 2019-10-19 at 17 49 23

my images not looks good as u can see above text of image cuts

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.