Manual/TableTest/ViewBasedCib: show how to bind in code a CPTableCellView subview

This commit is contained in:
cacaodev
2014-11-03 16:59:42 +01:00
parent e156badef6
commit db63c91f99
3 changed files with 92 additions and 44 deletions
@@ -98,6 +98,20 @@ CPLogRegister(CPLogConsole)
return self;
}
- (void)awakeFromCib
{
// self is the owner parameter specified in -makeViewWithIdentifier:owner:
// This method is called each time a cib containing a CPTableCellView is instantiated.
// Outlets are now connected and available.
// If the view has its own xib, only the view will be instantiated and connected to the owner.
if (externalView)
{
CPLog.debug(_cmd + " loaded externalView : " + externalView);
[[externalView textField] setTextColor:[CPColor greenColor]];
[imageView bind:CPValueURLBinding toObject:externalView withKeyPath:"objectValue.image.path" options:nil];
}
}
- (CPView)makeOrangeView
{
var orangeView = [[CustomView alloc] initWithFrame:CGRectMakeZero()];
@@ -189,19 +203,6 @@ CPLogRegister(CPLogConsole)
return [height intValue];
}
- (void)awakeFromCib
{
// self is the owner parameter specified in -makeViewWithIdentifier:owner:
// This method is called each time a cib containing a CPTableCellView is instantiated.
// Outlets are now connected and available.
// If the view has its own xib, only the view will be instantiated and connected to the owner.
if (externalView)
{
CPLog.debug(_cmd + " loaded externalView : " + externalView);
[[externalView textField] setTextColor:[CPColor greenColor]];
}
}
// CELL VIEWS ACTIONS
- (IBAction)_sliderAction:(id)sender
{
File diff suppressed because one or more lines are too long
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11G63</string>
<string key="IBDocument.InterfaceBuilderVersion">2844</string>
<string key="IBDocument.AppKitVersion">1138.51</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<int key="IBDocument.SystemTarget">101000</int>
<string key="IBDocument.SystemVersion">13F34</string>
<string key="IBDocument.InterfaceBuilderVersion">6250</string>
<string key="IBDocument.AppKitVersion">1265.21</string>
<string key="IBDocument.HIToolboxVersion">698.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2844</string>
<string key="NS.object.0">6250</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>NSArrayController</string>
@@ -74,6 +74,7 @@
<int key="NSStyle">0</int>
<bool key="NSAnimates">NO</bool>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<bool key="NSEditable">YES</bool>
</object>
<object class="NSTextField" id="230105450">
@@ -91,7 +92,7 @@
<int key="NSCellFlags2">272631808</int>
<string key="NSContents">Loaded From External Cib</string>
<object class="NSFont" key="NSSupport" id="783725094">
<string key="NSName">LucidaGrande</string>
<bool key="IBIsSystemFont">YES</bool>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
@@ -116,6 +117,8 @@
</object>
</object>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
<int key="NSTextFieldAlignmentRectInsetsVersion">1</int>
</object>
<object class="NSPopUpButton" id="474789846">
<reference key="NSNextResponder" ref="867617809"/>
@@ -127,7 +130,7 @@
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="412537776">
<int key="NSCellFlags">-2076049856</int>
<int key="NSCellFlags">-2076180416</int>
<int key="NSCellFlags2">2048</int>
<reference key="NSSupport" ref="783725094"/>
<string key="NSCellIdentifier">_NS:9</string>
@@ -191,6 +194,7 @@
<bool key="NSAltersState">YES</bool>
<int key="NSArrowPosition">2</int>
</object>
<bool key="NSAllowsLogicalLayoutDirection">NO</bool>
</object>
</array>
<string key="NSFrameSize">{375, 108}</string>
@@ -209,7 +213,7 @@
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<array key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">textField</string>
@@ -258,26 +262,6 @@
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">valueURL: objectValue.image.path</string>
<reference key="source" ref="624486786"/>
<reference key="destination" ref="867617809"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="624486786"/>
<reference key="NSDestination" ref="867617809"/>
<string key="NSLabel">valueURL: objectValue.image.path</string>
<string key="NSBinding">valueURL</string>
<string key="NSKeyPath">objectValue.image.path</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSValidatesImmediately</string>
<boolean value="YES" key="NS.object.0"/>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">163</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">hidden: objectValue.image</string>
@@ -528,15 +512,78 @@
<object class="IBPartialClassDescription">
<string key="className">TableViewDelegate</string>
<string key="superclassName">NSObject</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="_sliderAction:">id</string>
<string key="_textFieldBezeledAction:">id</string>
<string key="_textFieldNotBezeledAction:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="_sliderAction:">
<string key="name">_sliderAction:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="_textFieldBezeledAction:">
<string key="name">_textFieldBezeledAction:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="_textFieldNotBezeledAction:">
<string key="name">_textFieldNotBezeledAction:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contentController">NSArrayController</string>
<string key="externalView">NSView</string>
<string key="imageView">NSImageView</string>
<string key="personView">NSView</string>
<string key="placeView">NSView</string>
<string key="textField">NSTextField</string>
<string key="view">NSTableCellView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contentController">
<string key="name">contentController</string>
<string key="candidateClassName">NSArrayController</string>
</object>
<object class="IBToOneOutletInfo" key="externalView">
<string key="name">externalView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="imageView">
<string key="name">imageView</string>
<string key="candidateClassName">NSImageView</string>
</object>
<object class="IBToOneOutletInfo" key="personView">
<string key="name">personView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="placeView">
<string key="name">placeView</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="textField">
<string key="name">textField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo" key="view">
<string key="name">view</string>
<string key="candidateClassName">NSTableCellView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/TableViewDelegate.h</string>
<string key="minorKey">../.XcodeSupport/AppController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">NO</bool>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="4600" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">