Problem with setContentBorderThickness:forEdge: not actually setting the value
-
27-09-2019 - |
Question
I'm trying to use setContentBorderThickness:forEdge:
to create a bottom bar in a Cocoa application.
mipadi was on to something, but in testing it out, I think maybe this is a slightly different problem:
-(void) adjustContentBorderBasedOnArrayControllerSelection{
if(([[self.resultsArrayController selectionIndexes] count] == 0)){
[[self window] setContentBorderThickness:40.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
} else {
[[self window] setContentBorderThickness:60.0f forEdge:CGRectMinYEdge];
NSLog(@"%f", [[self window] contentBorderThicknessForEdge:CGRectMinYEdge]);
}
}
Both of those NSLog()
messages show the thickness value is 0.0 even after I explicitly set it. Anyone know what's up with that?
Solution
By any chance have you checked to make sure [self window] isn't nil? Do you have your outlet setup right? I get that behavior if the outlet to the window isn't set.
OTHER TIPS
You can use CGRectMinYEdge
. (On 64-bit systems, NSMinYEdge
is #define
'd as CGRectMinYEdge
anyway).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow