Problems with xib

  • I'm having issues with an inspector panel I created in IB.  I have
    several panels launched from the application level using the same techniques
    shown in the Sketch example.  The .nib files work properly, show/hide works,
    etc.  However, it does not work properly with the inspector panel, which is
    the only .xib file I have.

        I am using generic window controllers and the code in my application
    delegate is identical for each window.  As in Sketch, the delegate adds a
    category for the window controllers with "isWindowShown" and
    "showOrHideWindow".  The inspector window will bring up the panel, but the
    menu does not change to "Hide Inspector" and will not close it.  If it is
    closed from the window, it cannot be re-launched.  No such problems with the
    .nib windows.  The window settings in IB are identical for each panel, as is
    the code.

        Tracking in the debugger shows that once the inspector is launched,
    "window" in the category returns nil, which explains why it won't work.
    What I don't understand, is why it is nil.  Again, the only difference is
    the use of .xib rather than .nib.  It looks to me like there is a bug in the
    internal translation from .xib to .nib.  I tried saving and using a .nib
    with the same result.  However, since it does launch, it doesn't make much
    sense that "window" would be nil, unless the "release when closed" is
    getting set, regardless of its unchecked status in IB.
  • Hey Gordon -

    On Nov 2, 2007, at 1:23 PM, Gordon Apple wrote:

    > I'm having issues with an inspector panel I created in IB.  I have
    > several panels launched from the application level using the same
    > techniques
    > shown in the Sketch example.  The .nib files work properly, show/
    > hide works,
    > etc.  However, it does not work properly with the inspector panel,
    > which is
    > the only .xib file I have.
    >
    > I am using generic window controllers and the code in my
    > application
    > delegate is identical for each window.  As in Sketch, the delegate
    > adds a
    > category for the window controllers with "isWindowShown" and
    > "showOrHideWindow".  The inspector window will bring up the panel,
    > but the
    > menu does not change to "Hide Inspector" and will not close it.  If
    > it is
    > closed from the window, it cannot be re-launched.  No such problems
    > with the
    > .nib windows.  The window settings in IB are identical for each
    > panel, as is
    > the code.
    >
    > Tracking in the debugger shows that once the inspector is launched,
    > "window" in the category returns nil, which explains why it won't
    > work.
    > What I don't understand, is why it is nil.  Again, the only
    > difference is
    > the use of .xib rather than .nib.  It looks to me like there is a
    > bug in the
    > internal translation from .xib to .nib.  I tried saving and using
    > a .nib
    > with the same result.  However, since it does launch, it doesn't
    > make much
    > sense that "window" would be nil, unless the "release when closed" is
    > getting set, regardless of its unchecked status in IB.
    >

    Can you verify that your interface is indeed being loaded? When Xcode
    compiles your project, all of your XIB's are converted to NIB's, it
    might worth checking to see that the XIB is being compiled in into a
    NIB in the built product successfully. I would go look inside of the
    application package that is produced by Xcode and verify that there is
    indeed a nib in the place where you expect to load one from.

    Jon Hess


  • Good suggestion.  The .nib is there, the only one with a solid gold
    icon.  Just for kicks, I tried opening some of my .nibs from the package.
    All loaded, sans images, in spite of the images being in the same Resources
    folder in the package, except that the inspector .nib (from the .xib)
    crashes IB.  I guess that could be a clue.

        The inspector currently has no images, connections, or bindings.  It's
    just a raw panel containing two sets of tabs, each with various controls and
    views.

        Another fact that I forgot to mention is that the inspector wont even
    launch once unless I set "visibleAtLaunch", which I don't have to do with
    the other panels.  Once closed, it won't open again, which the others will.
    Like I said, "window" in the window controller returns nil.

    (time warp .....)

        Well, that's interesting.  A new day, a new perspective.  I just went
    into IB and in my tools nib deleted the connection from file's owner
    (NSApplication) to the panel.  Then I couldn't put it back.  I saved it and
    ran it and it showed the same behavior as the xib inspector.  In documents,
    I always set the files owner to the document.  Maybe the fact the the
    application does not maintain the same type of windows list might have
    something to do with it.  In both cases, I set the file's owner to
    NSWindowController and things now work for both panels.  They must have
    changed something here.  I guess that's going to make a longer path for my
    bindings since it looks link I'm going to have to go through the window
    controller to get to the application.  :-)

        I just looked at the Sketch example again.  They don't use xib.  Their
    file's owner is NSApplication and they have the "window" outlet (which does
    not exist in xib) connected to their panel, like I was originally trying to
    do.  Apparently the xib version has lost the "window" connection for file's
    owner.  They also show another controller (set to NSApplication) which
    doesn't appear to have any connections.  Maybe losing the "window"
    connection for file's owner was just an oversight in the new IB?  Should I
    file a bug report?  (BTW, I'm still on 9a559 because I've been unable to
    successfully download 9a581 and am still waiting for the disk to arrive.
    I'll wait and try it again.)

    >
    > Can you verify that your interface is indeed being loaded? When Xcode
    > compiles your project, all of your XIB's are converted to NIB's, it
    > might worth checking to see that the XIB is being compiled in into a
    > NIB in the built product successfully. I would go look inside of the
    > application package that is produced by Xcode and verify that there is
    > indeed a nib in the place where you expect to load one from.
    >
    > Jon Hess
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today