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

Rapidly switching between tabs causes view size to be wrong #9

Open
SamusAranX opened this issue Mar 12, 2019 · 10 comments
Open

Rapidly switching between tabs causes view size to be wrong #9

SamusAranX opened this issue Mar 12, 2019 · 10 comments
Labels
bug Something isn't working 💵 Funded on Issuehunt This issue has been funded on Issuehunt

Comments

@SamusAranX
Copy link
Contributor

SamusAranX commented Mar 12, 2019

Issuehunt badges

prefs

Is there an option to force view size recalculation every time another tab is selected?

There is a $60.00 open bounty on this issue. Add more on Issuehunt.

@DivineDominion
Copy link
Collaborator

@SamusAranX Can you check with the current master?

@SamusAranX
Copy link
Contributor Author

I updated my project to the new API, but calling .show() on my PreferencesWindowController does absolutely nothing now. My app's open windows lose focus, but no preferences window is actually being opened.

@SamusAranX
Copy link
Contributor Author

SamusAranX commented Apr 5, 2019

Just tried calling .show() with an identifier, but that doesn't work either.

Though I've noticed that the window does get opened after all:

Screenshot 2019-04-05 at 09 36 42

It's just that for some reason, it's invisible and doesn't participate in App Exposé.

@DivineDominion
Copy link
Collaborator

I encountered this only my content views wouldn't have a proper intrinsicContentSize. Using AutoLayout probably is the easiest fix. How are you creating your content views, and can you set their size more rigidly somehow?

@SamusAranX
Copy link
Contributor Author

I already use Auto Layout. My views are loaded from XIBs and there's nothing special about them.
image

Since the labels are fully localized, I can't really make their size explicit.

@sindresorhus
Copy link
Owner

@DivineDominion I can reproduce this by unchecking "Use Auto Layout" for the Advanced preference pane XIB. We need to be able to handle non-autolayout UI too, or if that's too difficult, at least throw an informative error.

The problem here is that https://github.com/sindresorhus/Preferences/blob/891d9df0ee36eb1e0d283051d0e17169371ed529/Sources/Preferences/PreferencesTabViewController.swift#L184 is .zero when Auto Layout is disabled on the view, so the window ends up being zero too. Maybe we could use viewController.view.bounds.size when viewController.view.fittingSize == .zero.

@sindresorhus sindresorhus added the bug Something isn't working label Apr 10, 2019
@IssueHuntBot
Copy link

@IssueHunt has funded $60.00 to this issue.


@SamusAranX
Copy link
Contributor Author

Just a heads up: Manually setting self.preferredContentSize in my views' various viewDidLoad() methods fixed the problem for me. It's not an optimal solution, but I couldn't find a better way to do it at the moment.

@sindresorhus
Copy link
Owner

If anyone wants to work on this, make sure to see the previous attempt and feedback: #28

@sindresorhus
Copy link
Owner

We should also check whether the situation improved in macOS 11.

dezinezync pushed a commit to dezinezync/Preferences that referenced this issue Dec 17, 2022
dezinezync pushed a commit to dezinezync/Preferences that referenced this issue Dec 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 💵 Funded on Issuehunt This issue has been funded on Issuehunt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants