Re: Multiple Nibs
Re: Multiple Nibs
- Subject: Re: Multiple Nibs
- From: "Colin O'Connor" <email@hidden>
- Date: Wed, 10 Nov 2004 23:15:40 -0500
Thanks for the response.
I've actually done all that already. I have a custom subclass of
NSImageView, and I've dragged an NSImageView icon into the window in IB, and
set the custom class, etc. Everything works with that one custom
NSImageView...the problem is I need more than just one of them, but I won't
know how many or where they'll be placed until runtime (the user would
create them and drag them around). In other words, I want a user of the
program to be able to create more instances of that custom NSImageView...so
I can't rely on placing the NSImageViews in IB.
I was suggesting multiple nibs as a solution to this...I'm not sure how it
work solve my problem, but I get the impression from researching this issue
that the solution might have something to do nibs.
Thanks again.
Colin
On 11/10/04 11:02 PM, "Brendan Younger" <email@hidden> wrote:
>
> On Nov 10, 2004, at 7:56 PM, Colin O'Connor wrote:
>
>> Hello,
>>
>> I'm new to Cocoa development, and this is actually my first post to
>> this
>> list.
>>
>> I've created a custom NSImageView, and I'd like to be able to create a
>> variable number of instances of this subclass. As in,
>> programmatically, I'd
>> like to create and position this NSImageView subclass on-the-fly.
>>
>> I'm under the impression that to accomplish this, a separate nib file
>> is
>> needed. Is that true? And if so, how would it be done?
>>
>> Thanks in advance,
>> Colin
>
> Not entirely sure what you mean by a separate nib. You can, if you
> wish, create your UI by dragging the NSImageView templates from the
> Cocoa palette and then, with the NSImageView selected, bring up the
> inspector (Command + shift + I) and in the "Custom Class" pane, select
> your custom subclass. (Assuming, of course, that you've already let IB
> know about the subclass by using the "Read Files..." menu item under
> the "Classes" menu.
>
> If you really want to place them programmatically (not recommended
> since it involves a lot of trial and error to get it positioned
> perfectly), you simply call "initWithFrame:" to initialize your
> subclass and then do something like [[window contentView]
> addSubview:myInstance];. Note that the NSRect you pass in to
> initWithFrame: is in the coordinate space of the superview of your
> custom view.
>
> Brendan Younger
>
>
>
_______________________________________________
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