about 9 years ago
NSSplitView have delegate methods where we control the minimum and maximum sizes of sections and which views expand or collapse by what amount.
Constraining the coordinates in the splitView:constrainMinCoordinate:ofSubviewAt: sets the minimum size of the view.
- (CGFloat)splitView:(NSSplitView *)sender constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)offset { NSView *subview = [[sender subviews] objectAtIndex:offset]; NSRect subviewFrame = subview.frame; CGFloat frameOrigin; if ([sender isVertical]) { frameOrigin = subviewFrame.origin.x; } else { frameOrigin = subviewFrame.origin.y; } CGFloat minimumSize = [[lengthsByViewIndex objectForKey:[NSNumber numberWithInteger:offset]] doubleValue]; return frameOrigin + minimumSize; }
The splitView:constrainMaxCoordinate:ofSubviewAt: delegate sets the maximum size of the views.
- (CGFloat)splitView:(NSSplitView *)sender constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)offset { NSView *growingSubview = [[sender subviews] objectAtIndex:offset]; NSView *shrinkingSubview = [[sender subviews] objectAtIndex:offset + 1]; NSRect growingSubviewFrame = growingSubview.frame; NSRect shrinkingSubviewFrame = shrinkingSubview.frame; CGFloat shrinkingSize; CGFloat currentCoordinate; if ([sender isVertical]) { currentCoordinate=growingSubviewFrame.origin.x + growingSubviewFrame.size.width; shrinkingSize = shrinkingSubviewFrame.size.width; } else { currentCoordinate = growingSubviewFrame.origin.y + growingSubviewFrame.size.height; shrinkingSize = shrinkingSubviewFrame.size.height; } CGFloat minimumSize = [[lengthsByViewIndex objectForKey:[NSNumber numberWithInteger:offset + 1]] doubleValue]; return currentCoordinate + (shrinkingSize - minimumSize); }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)