Re: A Nib Question: Multiple Instantiations of Views
Re: A Nib Question: Multiple Instantiations of Views
- Subject: Re: A Nib Question: Multiple Instantiations of Views
- From: Ondra Cada <email@hidden>
- Date: Thu, 4 Apr 2002 13:14:14 +0200
On Thursday, April 4, 2002, at 10:16 , The Amazing Llama wrote:
What I want to do is instantiate multiple copies of Bar, with different
text in the text objects, and pop them all into Foo so that all of them
appear in a list.
So the basic question is this: how do I
- load a view from the nib so that I get the formatting information,
- programmatically make lots of copies of it
- programmatically change the text, and
- programmatically put them all into the window?
Can I?
You can, but it would be the hard way.
The simple one is to go proper MVC, making so no necessity of direct
connections between the window (and its contents) and the view (and its
contents). Then you can simply put the view into a spearate NIB, and load
it as many times as you like to: that's the easiest and most convenient
way of making "lots of copies" of anything in GUI.
As for "changing the text" just use NSText(View|Field) services; as for
placing loaded views into the window use NSView services (or go NSTabView
or NSMatrix or NSSplitView or whatever is suitable for your task).
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.