Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seeting a Background Image for StackViewController #57

Closed
jenixgnanadhas opened this issue Jun 29, 2020 · 4 comments
Closed

Seeting a Background Image for StackViewController #57

jenixgnanadhas opened this issue Jun 29, 2020 · 4 comments

Comments

@jenixgnanadhas
Copy link

Hi All,
Im using StackViewController in one of my Projects. Currently im using "backgroundcolor" property to set the BG color of the View. Now i have a new Req in which i need to set an Image as the Background. Is it Possible using this Framework ?
I tried adding a subview to the "backgroundView" property and it is not working out. Please provide some pointers.

Thank you :)

@louoso
Copy link

louoso commented Jun 30, 2020

Hi Jenix, can you give me more detail about what isn't working? Maybe a code example I could check out? I would expect that you could add a subview to the background view or use the pattern init of UIColor. https://developer.apple.com/documentation/uikit/uicolor/1621933-init

@jenixgnanadhas
Copy link
Author

Hi @louoso
StackViewController-master.zip
Thanks for the reply :)
I have modified and attached the example code of this repo. I was able to change the BG colour using .backgroundcolor property and also pattern image works fine(But we have to add a large image to support both portrait and landscape).

Im not sure why the "backgroundview" property is not working for me. I have added a test image in this example code and created an image view with a smaller frame and added this image view as the subview of "backgroundview".

please advice if the above approach is right or if i should change something. Thanks alot :)

@louoso
Copy link

louoso commented Jul 1, 2020

So in this case that property isn't exposing an existing UIView, but is giving you the option to set that property to something that will then be added and pinned to the edges.

So you would want something like this:

let imageView = ...
stackViewController.backgroundView = imageView

Best of luck.

@louoso louoso closed this as completed Jul 1, 2020
@jenixgnanadhas
Copy link
Author

Hi @louoso
Thanks, Thanks alot :) It Works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants