5

I need a full screen window with a lot of stuff in it , made by Cocoa Xcode 4. But there is a persistent warning: any time I try to resize the main window, I receive this warning ( code compiles well , but I am sure something will go wrong for users with small screens) this is the warning:

" Unsupported Configuration Content rectangle not entirely on screen with the menu bar ( May not be completely seen for all screen resolution and configurations)"

I have 2 questions:

1- what is best way to get rid of this warning (except using smaller window because the warning starts around 560 x 560 window size. I can't use such a small screen for that stuff)

2- How can I tell the program to open in full screen at the beginning ?

Aug
  • 595
  • 9
  • 22

2 Answers2

3
  1. You just need to move the window in the sizing inspector in IB.

  2. This SO question should answer that.

Community
  • 1
  • 1
trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Thanks. I checked that link and found instead of using the whole initWithContentRect method, I can use a simpler way. By how, your answer led to my solution. – Aug Sep 14 '12 at 13:39
2

This is the code I could use under this link that thankfully "trojanfoe" let me know

Creating NSWindow in fullscreen mode

This is simplified code:

Remember that Cocoa does not make @synthesize in AppDelegate.m for default window. You need to add @synthesize window; manually

1- first we fill up screenRect with screen size 2- in size inspector set window position to " Fixed from Left" and make any offset needed you must payoff that offset in your code later ( Here I used 10 px of offset and 40px pay off. this resulted in exactly the same window size as Xcode ! enter image description here

3- add this code:

  • (void)applicationDidFinishLaunching:(NSNotification *)aNotification {

    // set to open in full screen mode:

    NSRect screenRect;

    NSSize screenSize;

    NSArray *screenArray = [NSScreen screens];

    NSUInteger screenCount = [screenArray count];

    for (NSUInteger index=0; index < screenCount; index++)

    {

    NSScreen *screen = [screenArray objectAtIndex: index];
    
    screenRect = [screen visibleFrame];
    

    }

    // Now screenRect contain Screen size

    screenSize.height= screenRect.size.height; screenSize.width= screenRect.size.width;

    [window setContentSize:screenSize]; }

enter image description here

Community
  • 1
  • 1
Aug
  • 595
  • 9
  • 22