0
votes

I've got this code to read a preference. The output to the console is 1, but the window is not set to NSModalPanelWindowLevel. I have tried to use 1 instead of @"1" but that doesn't work either.

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

NSString *alwaysonforeground = [defaults objectForKey:@"alwaysonforeground"]; if (alwaysonforeground == @"1") [window setLevel:NSModalPanelWindowLevel]; NSLog(alwaysonforeground);

1

1 Answers

2
votes

You want this function

if ([alwaysonforeground isEqualToString:@"1"]) { }