Search code examples
cocoasplitnssplitview

How to hide a divider of nssplitview?


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!


Solution

  • 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.