views:

67

answers:

1

Now I want to hide or show with my condition a divider when my app run. used this delegate method:

- (BOOL)splitView:(NSSplitView *)splitView shouldHideDividerAtIndex:(NSInteger)dividerIndex
{
   if (A) 
       return YES;
   else 
       return NO;
}

but it didn't work , why? How to used this method? Thank you very much!

+3  A: 

The split view sends that message to its delegate, to ask the delegate whether it should hide that divider. So, be the delegate, and answer the split view's question.

Be sure to check out the documentation. It's possible that that message won't accomplish what you want it to. The documentation lists everything you can do by responding to that message.

Peter Hosey
I have set the delegate of my class ,but still not work ?
jin
You need to set the delegate of the split view to an instance of your class, and that instance needs to respond to the appropriate message (see the documentation I linked to) with the correct value.
Peter Hosey