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

How to fix Layout Error while using WhatsNewKit Library in Swift 5? #39

Closed
christophriepe opened this issue Apr 22, 2020 · 6 comments
Closed
Labels
help wanted Extra attention is needed

Comments

@christophriepe
Copy link

Hey,

I ran into an error while using WhatsNewKit. I posted a Question on StackOverflow. Here is the link: https://stackoverflow.com/questions/61372170/how-to-fix-layout-error-while-using-whatsnewkit-library-in-swift-5

Can you think of a reason why this is happening to me?

Thanks a lot for your help in advance.

@SvenTiigi
Copy link
Owner

Hey @christophriepe,

it seems like you are using a non transparent image or loading the UIImage via the provided name fails this is why the image get tinted in its full bounds.

If you want to disable the default autoTintImage behaviour you can simply change the ItemsView configuration.

configuration.itemsView.autoTintImage = false

As the ItemsView is centered it seems like you are setting the ItemsView.ContentMode to .center the default behaviour as seen in the example application is .top.

// ContentMode Top
configuration.itemsView.contentMode = .top

// ContentMode Center
configuration.itemsView.contentMode = .center

// ContentMode Fill
configuration.itemsView.contentMode = .fill

Please provide a code snippet of your WhatsNewViewController configuration and presentation in order to identify the misconfiguration.

@SvenTiigi SvenTiigi added the help wanted Extra attention is needed label Apr 22, 2020
@christophriepe
Copy link
Author

Thanks for your answer @SvenTiigi.

Here is my code for the configuration:

let theme = WhatsNewViewController.Theme { configuration in
    configuration.completionButton.backgroundColor = UIColor.yellow
    configuration.completionButton.titleColor = UIColor.black
            
    configuration.itemsView.contentMode = .top
}
let config = WhatsNewViewController.Configuration(theme: theme)

I now chose the example images in the Example folder but this wasn't the issue. It is still looking the same way as before.

Bildschirmfoto 2020-04-23 um 18 06 48

To see the whole source code for this WhatsnewViewController see the linked StackOverflow Question, as well as for the error messages.
https://stackoverflow.com/questions/61372170/how-to-fix-layout-error-while-using-whatsnewkit-library-in-swift-5

I hope you guys can see something I can't. Thanks a lot for your help in advance.

@SvenTiigi
Copy link
Owner

Hey @christophriepe,

I've created an example app and added your provided code snippet.

Bildschirmfoto 2020-04-23 um 18 47 40

The ItemsView is correctly displayed at the top position.
Please try the same with a small example app to encapsulate the bug.

It might be that somewhere in your code the ItemsView Configuration gets set to center.

@christophriepe
Copy link
Author

Thanks for your answer @SvenTiigi, that fixed the first problem I had.

However in all examples the Item View takes the whole available space like in the image below:

Bildschirmfoto 2020-04-23 um 18 56 21

Why is my Item View (or the one in the example app of your last post) only taking more or less a quarter of The available space?

Is there any configuration to let the Item View fill out all the available space?

@SvenTiigi
Copy link
Owner

To fill the available space along the axis

configuration.itemsView.contentMode = .fill

https://github.com/SvenTiigi/WhatsNewKit#contentmode-

Additionally, you can make use of the Insets API to modify the size of the ItemsView

https://github.com/SvenTiigi/WhatsNewKit#insets

@christophriepe
Copy link
Author

Thanks, @SvenTiigi, its working now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants