Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:56:56+00:00 2026-06-11T13:56:56+00:00

I created a new blank standard application using Xcode template. Removed the window in

  • 0

I created a new blank standard application using Xcode template. Removed the window in MainMenu.xib and I created a new customized NSWindowController subclass with a xib.

They were named “WYSunFlowerWindowController.h” and “WYSunFlowerWindowController.m”.

And I append then init function like below:

- (id)init
{
    NSLog(@"init()");

    return [super initWithWindowNibName:@"WYSunFlowerWindowController" owner:self];
}

And my WYAppDelegate.m file is like below:

static WYSunFlowerMainWindowController* windowController = nil;

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application
    if (windowController == nil) {
        windowController = [[WYSunFlowerMainWindowController alloc] init];
    }
    [[windowController window] makeKeyAndOrderFront:windowController];
}

And I have the problem, that the window can’t show it self after I launch the app. Anyone can tell me why? Is anything wrong with my code?

I am a newbie in Objective-C and cocoa. So I think I maybe make a silly mistake that I can’t figure it out by myself.

UPDATE:

Here is my project source. Pleas have a look and help me to figure out what is my mistake。

https://dl.dropbox.com/u/3193707/SunFlower.zip

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:56:57+00:00Added an answer on June 11, 2026 at 1:56 pm

    In your init method, I think you have to set self to the super init first before you return self.

    -(id)init
    {
        NSLog (@"init()");
        self = [super initWithWindowNibName:@"WYSunFlowerWindowController" owners:self];
        return self;
    }
    

    Edit:

    Try replace makeKeyAndOrderFront: with [windowController showWindow:self]

    Then if that still doesn’t work, check your window controller xib, make sure the file owner is set to WYSunFlowerWindowController and that the IBOutlet Window (declared in NSWindowController) is connected to the window.

    Edit 2:

    Commenting out your @property and @synthesize window in your controller was the trick. Don’t redeclare get and setters that were already predefined in a superclass.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using eclipse platform and window builder pro within. I've already created new project
I have created a new team project using sfts v3.0 project template. Later I
Lets go from the start Created New Xcode project,opened interface builder dragged one NSButton
I created a new cordova project on XCODE, I have some files that I
When I created a new content page, the link to document was showing blank
I created a new blank win32 C++ project in Visual Studio 2010. I inputted
I created a brand new blank Visual Studio 2010 solution, and added an existing
I create new blank solution. Add exist web site. Structure: Solution E:...\projectname Folders: bin
Eclipse and MyEclipse create new Java files with an extra blank line after the
I've created new db via phpMyAdmin and while editing db privilages clicked delete localhost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.