[MacRuby-devel] What's the best way to implement a delegate/action with multiple parameters?

Benjamin Stiglitz ben at tanjero.com
Fri Nov 21 12:43:38 PST 2008


> I'm pretty new to Cocoa, so maybe I'm overlooking the obvious here.   
> I just want to make sure I'm not doing more work than necessary.
>
> I'd like to be able to control the minimum size for a NSSplitView.   
> As I understand it, I need to have a delegate with a method that can  
> handle
> splitView:constrainMaxCoordinate:ofSubviewAt:
>
> So far that isn't supported using Interface Builder, is it?
>
> If I need to do it 'manually'  - do I get a reference to the  
> NSSplitView, and then tell it to set its delegate to something that  
> responds to the method?  When/where should I do this - in the Window  
> Controller's AwakeFromNib or some other place?

You can set the delegate in Interface Builder by ctrl-clicking from  
the split view to the delegate object and clicking “delegate” in the  
resulting HUD popup. Then just implement that method on your delegate  
object.

If you haven’t already, be sure to check out the Delegates and Data  
Sources guide at:
<http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_4.html 
 >

-Ben


More information about the MacRuby-devel mailing list