• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Newbie: Getting an NSWindow and setting its delegate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Getting an NSWindow and setting its delegate


  • Subject: Re: Newbie: Getting an NSWindow and setting its delegate
  • From: Martin Linklater <email@hidden>
  • Date: Sat, 30 Jul 2005 16:40:24 +0100


Hi,

You are probably thinking way to complicated ;-) I'm just going through the book myself, so as a help for you and a reminder for me, here's how I did it. Of course, I'm not a Cocoa pro, but I think it is a correct way to do it.


Cool. Although I got it working with a lot less code than your example. I'm not sure if I've done something horrendous but my solution was a bit simper.


- Create simple Cocoa project in XCode.

- Double click the NIB - CTRL-drag from the Window instance to the AppController instance - connect the delegator.

Then simply add this function declaration and definition to AppController.h /.m respectively:

*** add to AppController.h

- (NSSize)windowWillResize:(NSWindow *)sender
                    toSize:(NSSize)frameSize;

*** add to AppController.m


- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize { frameSize.width = frameSize.height / 2;

    return frameSize;
}

Then when I resize the Window the size is snapped to be twice as high as it is wide. Am I missing anything important by not including all the IBOutlet stuff that is present in your code ?


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Newbie: Getting an NSWindow and setting its delegate
      • From: Michael Ströck <email@hidden>
References: 
 >Newbie: Getting an NSWindow and setting its delegate (From: Martin Linklater <email@hidden>)
 >Re: Newbie: Getting an NSWindow and setting its delegate (From: Michael Ströck <email@hidden>)

  • Prev by Date: longjmp exit
  • Next by Date: Re: longjmp exit
  • Previous by thread: Re: Newbie: Getting an NSWindow and setting its delegate
  • Next by thread: Re: Newbie: Getting an NSWindow and setting its delegate
  • Index(es):
    • Date
    • Thread