嗨我試圖約束NSSplitView的最大和最小座標。我創建了一個視圖控制器並將其指定爲NSSplitView的委託。然而,委託方法被調用,但分割視圖不會限制到我試圖將其設置爲的位置。任何關於我在做什麼的錯誤?如何約束NSSplitView?
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(NSInteger)dividerIndex
{
NSLog(@"Constrain min");
if (proposedMinimumPosition < 75)
{
proposedMinimumPosition = 75;
}
return proposedMinimumPosition;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
NSLog(@"Constrain max");
if (proposedMax > 200)
{
proposedMax = 200;
}
return proposedMax ;
}
10.10不適合我。 – SpaceDog 2015-01-17 04:24:09