Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
I am having a great deal of difficulty in working out how to load then display a basic Xib.

I have used source file from a book I purchased (Apress: Learn Cocoa on the Mac) and when running this code all does what it is meant to do.

I try and duplicate this myself and for the life of me I can't get it to work and I am sure I have the exact same code - so I am guessing it could be a XCode setting preventing it.

I have attached the code (Demo.zip) id anyone cares to take a look - it is pretty basic so it won't be difficult to follow what I am trying to achieve. Don't worry about the WindowTwo.xib as I can't even get WindowOne to work.

Good Luck.

Fritzables.
 

Attachments

  • Demo.zip
    84.6 KB · Views: 93
Last edited:

Madd the Sane

macrumors 6502a
Nov 8, 2010
534
73
Utah
A few comments about your code: the first letter of an Objective C function should be lowercase. Store the window or window controller, otherwise the object will leak (MRC) or get deallocated (GC/ARC).

Now, the reason why your window isn't showing: you're not telling it to display: -showWindow: will do that; -window will just return a pointer to the internal NSWindow object (it will also initialize the outlet pointers and hook up actions to get ready for the NSWindow object.).
 

Fritzables

macrumors regular
Original poster
May 6, 2011
149
1
Brisbane AUSTRALIA
G'Day Madd,

Thanks very much for that.

I gotta say, after banging my head around over this code, paying attention to format was not something I was concerned about - but again, no excuses.

Again, thanks for the tip on the code itself.

Fritzables.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.