• 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: Linking an NSWindow in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking an NSWindow in IB


  • Subject: Re: Linking an NSWindow in IB
  • From: Guy Halford-Thompson <email@hidden>
  • Date: Wed, 31 Aug 2011 21:18:31 -0700

Thanks for all the responses.

I have managed to get it working using Jens response... it seems I got
a bit confused about how the linking via IB goes.

@Ron, thanks for the recommendation, I am finding it very difficult to
find good resources for Cocoa programming, and the apple developer
docs are not exactly easy to follow.

Many thanks

Guy

On 31 August 2011 20:06, Ron Fleckner <email@hidden> wrote:
> Hello Guy,
>
> It's good that you posted some more code.  Your 'MyWindow' object is a subclass of NSObject.  Even if it was a subclass of NSWindow, which I think is what you want (a window, right?), you still set up a separate window in code with alloc-init, which in any case is not a window but an NSObject.  Really, at this point, you can't keep asking questions without first doing some basic homework yourself. I doubt that people here will bother answering your questions until you've done that.
>
> I recommend Aaron Hillegas's excellent 'Cocoa Programming For Mac OS X'
>
>
> On 01/09/2011, at 12:54 PM, Guy Halford-Thompson wrote:
>
>> Hi,
>>
>> Thanks for the help, I really appreciate it.
>>
>> I still appear to be having some trouble tho.
>>
>> Here is my code:
>>
>> MyWindow.h
>> ----------------
>> #import <Cocoa/Cocoa.h>
>>
>> @interface MyWindow : NSObject <NSWindowDelegate> {
>>
>>   IBOutlet NSWindow *window;
>> }
>>
>> -(void)showWindow:(id)sender;
>>
>> @property (assign) IBOutlet NSWindow *window;
>>
>> @end
>>
>> MyWindow.m
>> -------------------
>>
>> #import "MyWindow.h"
>>
>> @implementation MyWindow
>>
>> @synthesize window;
>>
>> -(void)showWindow:(id)sender {
>>   NSLog(@"**Window %@",window);
>>   [window makeKeyAndOrderFront:nil];
>> }
>>
>> @end
>>
>>
>> Then... in my main app delegate....
>>
>> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>>
>> if {...condition is met....} {
>>        MyWindow *uni = [[MyWindow alloc] init];
>>        [uni showWindow:nil];
>>  }
>> }
>>
>> But its still not working...
>>
>> Sorry if this is pretty basic, but getting my head round objective C
>> is proving to be difficult.
>>
>> Thanks
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
>



--
Guy Halford-Thompson
Blog                  - http://www.cach.me/blog
Twitter               - https://twitter.com/mrwooster
Google Plus       - http://gplus.name/guy
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Linking an NSWindow in IB (From: Guy Halford-Thompson <email@hidden>)
 >Re: Linking an NSWindow in IB (From: Ron Fleckner <email@hidden>)
 >Re: Linking an NSWindow in IB (From: Guy Halford-Thompson <email@hidden>)

  • Prev by Date: Re: setTitleWithMnemonic
  • Next by Date: Re: setTitleWithMnemonic
  • Previous by thread: Re: Linking an NSWindow in IB
  • Next by thread: LLVM 2.1 Error
  • Index(es):
    • Date
    • Thread