0
votes

I am on objectiveC, OSX, not iOS. XCode 8.3

I have a preferences Window (custom NSWindow) that opens as a modal on my main window.

The preferences window itself contains a view with tabs. The tab height changes the windows size whenever one is clicked.

First Tab clicked:

enter image description here

Second Tab clicked:

enter image description here

Now if someone hides the application in the dock and activates it again, the preferences window becomes active with the height of tab 1, even if tab 2 is still active. So the content gets cut off.

enter image description here

What i need is some kind of notification that gets triggered on becoming active/visible again to trigger a resize of the window before it gets displayed.

I tried it with these notifications in my NSWindow subclass (with NSWindow delegate set).

- (void)windowDidResignMain:(NSNotification*)notification{
NSLog(@"windowDidResignMain");
}

- (void)windowDidResignKey:(NSNotification*)notification{
NSLog(@"windowDidResignKey");
}

- (BOOL)canBecomeKeyWindow{
    return YES;
}

- (BOOL)canBecomeMainWindow{
    return YES;
}

But none of them worked. Is it because it's a modal window? Any help appreciated.

1
That shouldn't happen. What ways of placing/resizing are you using here? Auto Layout? Springs and struts?How are you resizing the windows? How are you populating/switching the tabs?uliwitness

1 Answers

0
votes

I found it. My mistake - my tabViewController triggered a resize on viewWillAppear with always the first tab. I changed that to the current selected tab and that was it.