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

Why do custom views not display? #362

Open
qianlipeng opened this issue Jan 5, 2021 · 1 comment
Open

Why do custom views not display? #362

qianlipeng opened this issue Jan 5, 2021 · 1 comment

Comments

@qianlipeng
Copy link

Please fill out this template when filing an issue.
All ℹ symbols should be replaced with information on the issue.
Please remove this line and all above before submitting.

Report

Environment

Please provide information on your development environment, so we can build with the same scenario.

  • Xcode version (e.g. 9.1): ℹ
  • PopupDialog version (e.g. 0.5.0): ℹ
  • Minimum deployment target (e.g. 9.0): ℹ
  • Language (Objective-C / Swift): ℹ
  • In case of Swift - Version (e.g. 4): ℹ

Dependency management

If you are not using any dependency managers, you can remove this section.

  • Dependency manager (e.g. CocoaPods): ℹ
  • Version (e.g. 1.3.1): ℹ

What did you do?

ℹ Please replace this with what you did.

What did you expect to happen?

ℹ Please replace this with what you expected to happen.

What happened instead?

ℹ Please replace this with of what happened instead.

Project that demonstrates the issue

ℹ In complex cases, it might be useful to link to a sample project. If you don't provide an example, you can delete this section.

@Fando
Copy link

Fando commented Jan 7, 2021

Hey, this is why your custom view is not showing up. mwfire/PopupDialogCustomExample#2 (comment)

I was struggling with the same issue until I found this comment. Specifically the point: Make sure to have a seamless chain of constraints from top to bottom.

Here's a list of reasons for why your custom view might not be showing

  1. You don't have any elements inside your view so the height ends up being 0, or
  2. If you are testing an empty view, you should set a specific height constraint, or
  3. If you have elements in your view, Make sure to have a seamless chain of constraints from top to bottom. This way, the dialog height will adapt to the height of the elements inside the view.

I had constraints on all my views, but they were not a seamless chain from top to bottom. One missing constraint was breaking the chain, and preventing the view height from being determined by the PopupDialog. This was causing the view height to be calculated as zero.

Also, do not confuse, "Unable to simultaneously satisfy constraints", with "a non-seamless constraint chain", they are not the same. In my case, all constraints were satisfied and none were conflicting, but there was no seamless chain from top to bottom.

I hope this saves someone time! I'm an iOS noob, learning the ropes.

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