Need help with CNSplitView?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

phranck
122 Stars 19 Forks 48 Commits 3 Opened issues

Description

CNSplitView is an feature enhanced derivative of NSSplitView. It has support for sticky top or bottom toolbars for each of its subviews.

Services available

!
?

Need anything else?

Contributors list

No Data

Flattr this git repo Travis Status

Overview

CNSplitView
is an feature enhanced derivative of
NSSplitView
. It has support for sticky top or bottom toolbars for each of its subviews. You can configure
CNSplitView
to add toolbars with buttons and/or drag handles, you can define the orientation of each button inside the toolbar or center it all.

Here are two shots of the included example application:

CNSplitView Example - Vertical SplitView

CNSplitView Example - Horizontal SplitView

Graphics & Icons

The icon used to show in the example application (green leaf) was taken from IconFinder. It is published under the CC License Attribution-Noncommercial 3.0 and was created by Bruno Maia, IconTexto.

Installation

Via CocoaPods

Just add

pod 'CNSplitView'
to your podfile.

Via Git SubModule

cd
into your project directory and execute
git submodule add https://github.com/phranck/CNSplitView.git $DIR_WHERE_YOUR_SUBMODULES_ARE_PLACED

You have to replace the

$DIR_WHERE_YOUR_SUBMODULES_ARE_PLACED
with the real path where your submodules are placed.

Manually

Download the entire project from Github via

git clone https://github.com/phranck/CNSplitView.git
,
cd
into the
CNSplitView
directory and drag the underyling
CNSplitView
directory to your Xcode project.

How to run the example

To run the example application you have to complete this project by opening a terminal and

cd
into the directory where your
CNSplitView Example.xcodeproj
is. Here you will find a
Podfile
. Type
pod install
(or
pod update
if you have done it before) to install (or update) all dependencies.
CNSplitView
needs another component
CNBaseView
.

After the creation of

CNSplitView Example.xcworkspace
you're done. Now you only have to use the workspace file!

Usage

The usage of

CNSplitView
is quite simple. In Interfacebuilder just create a new window, grab a
NSSplitView
from the objects palette and drop it onto the content view of your window. Select the the size inspector and let it fill the container both horizontally and vertically. Then you select the identity inspector and set the class of this
NSSplitView
to
CNSplitView
. In Interfacebuilder you're done for that moment.

On the code side you keep going that easy way. The code of the example application looks like this:

NSMenu *contextMenu = [[NSMenu alloc] init];
[contextMenu addItemWithTitle:@"Add new Item" action:@selector(contextMenuItemSelection:) keyEquivalent:@""];
[contextMenu addItemWithTitle:@"Add new Group" action:@selector(contextMenuItemSelection:) keyEquivalent:@""];
CNSplitViewToolbarButton *button1 = [[CNSplitViewToolbarButton alloc] initWithContextMenu:contextMenu];
button1.imageTemplate = CNSplitViewToolbarButtonImageTemplateAdd;

CNSplitViewToolbarButton *button2 = [[CNSplitViewToolbarButton alloc] init]; button2.imageTemplate = CNSplitViewToolbarButtonImageTemplateRemove;

CNSplitViewToolbarButton *button3 = [[CNSplitViewToolbarButton alloc] init]; button3.imageTemplate = CNSplitViewToolbarButtonImageTemplateLockUnlocked; button3.imagePosition = NSImageRight; button3.title = @"Lock";

CNSplitViewToolbarButton *button4 = [[CNSplitViewToolbarButton alloc] init]; button4.imageTemplate = CNSplitViewToolbarButtonImageTemplateRefresh; button4.title = @"Refresh";

NSTextField *textField = [[NSTextField alloc] init]; [textField setBezeled:YES]; [textField setBezeled:NSTextFieldRoundedBezel]; [textField setToolbarItemWidth:120.0];

NSPopUpButton *popupButton = [[NSPopUpButton alloc] init]; [popupButton setToolbarItemWidth:120]; [popupButton addItemsWithTitles:@[@"Chelsea Manning...", @"Edward Snowden...", @"Aaron Swartz..."]]; [[popupButton cell] setControlSize:NSSmallControlSize];

NSSlider *slider = [[NSSlider alloc] init]; [slider setToolbarItemWidth:120.0]; [[slider cell] setControlSize:NSSmallControlSize];

[toolbar addItem:button1 align:CNSplitViewToolbarItemAlignLeft]; [toolbar addItem:button2 align:CNSplitViewToolbarItemAlignLeft]; [toolbar addItem:button3 align:CNSplitViewToolbarItemAlignRight]; [toolbar addItem:button4 align:CNSplitViewToolbarItemAlignRight]; //[toolbar addItem:popupButton align:CNSplitViewToolbarItemAlignLeft];

self.splitView.delegate = self; self.splitView.toolbarDelegate = self; [self.splitView attachToolbar:toolbar toSubViewAtIndex:attachedSubViewIndex onEdge:CNSplitViewToolbarEdgeBottom];

Requirements

CNSplitView
was written using ARC and should run on 10.7 and above. You have to add the QuartzCore Framework to your project.

Contribution

The code is provided as-is, and it is far off being complete or free of bugs. If you like this component feel free to support it. Make changes related to your needs, extend it or just use it in your own project. Pull-Requests and Feedbacks are very welcome. Just contact me at [email protected] or send me a ping on Twitter @TheCocoaNaut.

Documentation

The complete documentation you will find on CocoaDocs.

License

This software is published under the MIT License.

Software that uses CNSplitView

If you like this component and if you're using it in your own software so please let me know. I'll give you a mention and set a link to your website (or the Mac App Store, if it exists).

CNSplitView
is used by this software: * BezierCode - BezierCode is an intuitive vector drawing that generate Objective C code.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.