malcommac / dmsplitview Goto Github PK
View Code? Open in Web Editor NEWNew NSSplitView class with multiple subviews resize behaviors and animated transitions
New NSSplitView class with multiple subviews resize behaviors and animated transitions
When expanding or collapsing the sub views, the value for newState in the delegate method splitView:subview:stateChanged: is always 0 (DMSplitViewStateCollapsed). When expanding, it should be 1 (DMSplitViewStateExpanded).
Hey,
I know this is not trivial and you may ignore me if this is to much work, but would be nice to have.
When the window resizes the views changes size also. It is desired that when window resized only the middle view should change size while the left and right view should stay at the same size. Check out XCode to see this behaviour.
In the following method:
near the top of that method, you have the following:
if ([self.eventsDelegate respondsToSelector:@selector(splitView:splitViewIsAnimating:)])
[((id <DMSplitViewDelegate>)self.delegate) splitView:self splitViewIsAnimating:YES];
You should be sending the call to splitView:splitViewIsAnimating: to self.eventsDelegate, but you are actually sending it to self.delegate
When dragging pane dividers, the MaxSize of a pane is not taken into consideration; only the MinSize.
MaxSize seems to not take effect on initial resize either.
If you have a subview within a panel that is supposed to be aligned centred (either no strut is selected or the top strut is the only one selected for Autosizing in Interface Builder), then when you toggle any of the panels, the subview will end up being right-aligned instead of maintaining its centre position.
For example, the initial view with the icons properly centred:
Then after clicking on the Toggle buttons (left and right), it looks like this:
It's happening in the example app and in my app that's using DMSplitView too.
I'm not sure what's causing this problem. It doesn't happen if you drag the left pane so it's fully closed, but it does with the right most pane. It also doesn't happen on the left pane if you double-click on the divider bar to collapse or expand the view.
Also, after this happens, no amount of dragging the divider bar will correct it. The subview (the icon in this case) is stuck to the right edge of its superview.
And it doesn't matter if you use animated transitions or not. Same problem.
Any workaround for this that you know of?
When you set an autoSaveName for the split view, collapse a view, then quit and re-launch the app, the following error is displayed:
<DMSplitView: 0x100192e20>: the delegate <DMSplitView: 0x100192e20> was sent -splitView:resizeSubviewsWithOldSize: and left the subview frames in an inconsistent state:
Split view bounds: {{0, 0}, {816, 337}}
Subview frame: {{0, 0}, {100, 337}}
Subview frame: {{110, 0}, {644, 337}}
Subview frame: {{764, 0}, {152, 337}}
DMSplitViewExample[41225:303] The outer edges of the subview frames are supposed to line up with the split view's bounds' edges. NSSplitView is working around the problem, perhaps at the cost of more redrawing. (This message is only logged once per NSSplitView.)
The same thing is happening in my app as happens in the example app.
Very nice controller. Thank you for sharing it. Right now it crashes when the window gets resized. In your demo you can test this by resizing the window down.
High level overview of the bug: You're using a dictionary for priorityIndexes, so you effectively loose sight of view indexes if you have 2 or more subviews set to the same priority.
Here was my specific scenario:
I have a vertical DMSplitView with 3 subviews. I want the middle subview to be resized when the window is resized, but I'd like the outer subviews to stay at a fixed size (unless they are manually resized).
So in my setup, I had the following priorities set for my subviews:
subview 0: 490
subview 1: 1
subview 2: 490
Because priorityIndexes uses priority as the key, it lost sight of subview 0 (because when I made the call to setPriority: 490 ofSubviewIndex: 2, that overwrote the entry in the dictionary for subview 0.
The main problem this created was that subview 0 would no longer get vertically resized because subview 0 wasn't in the priorityIndexes dictionary anymore.
The obvious workaround for my case was to simply set subview 2's priority to 489 and now it resizes as expected.
In the example project, I changed the splitview arrange style to be "top to bottom".
With this setting, the dividers begin to jump when dragging them. Is vertical orientation not supported here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.