Settings icon indicating copy to clipboard operation
Settings copied to clipboard

Rapidly switching between tabs causes view size to be wrong

Open SamusAranX opened this issue 6 years ago • 10 comments

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.

SamusAranX avatar Mar 12 '19 09:03 SamusAranX

@SamusAranX Can you check with the current master?

DivineDominion avatar Apr 04 '19 06:04 DivineDominion

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 avatar Apr 05 '19 07:04 SamusAranX

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é.

SamusAranX avatar Apr 05 '19 07:04 SamusAranX

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?

DivineDominion avatar Apr 05 '19 12:04 DivineDominion

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.

SamusAranX avatar Apr 08 '19 11:04 SamusAranX

@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 avatar Apr 10 '19 12:04 sindresorhus

@issuehunt has funded $60.00 to this issue.


IssueHuntBot avatar Apr 11 '19 12:04 IssueHuntBot

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.

SamusAranX avatar Apr 16 '19 08:04 SamusAranX

If anyone wants to work on this, make sure to see the previous attempt and feedback: https://github.com/sindresorhus/Preferences/pull/28

sindresorhus avatar Aug 10 '20 18:08 sindresorhus

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

sindresorhus avatar Aug 10 '20 18:08 sindresorhus