FROM : Markus Spoettl
DATE : Tue Jun 24 23:24:55 2008
On Jun 24, 2008, at 1:36 PM, Keary Suska wrote:
> I would have each "row" of controls as a vanilla NSView in a
> separate nib.
> Your controller class, which would be the nib owner, could manage
> each "set"
> of controls. You'll need to familiarize yourself with nib loading
> (particularly NSNib's methods) and the cocoa drawing system
> (particularly
> views and subviews, and the coordinate system), at least. There may
> be more
> that I am not thinking of.
In addition to what Keary Suska said, you can use NSViewController to
manage the custom compound view located it's own NIB. NSViewController
will manage memory, help with bindings and general management.
Basically everyhing you would have to do manually otherwise.
NSViewController is available in 10.5.
See http://developer.apple.com/documentation/Cocoa/Reference/NSViewController_Class/Introduction/Introduction.html
for more information.
The basic steps are these:
1) create a custom NSViewController derived class (MyViewController)
which will manage one row of controls in your UI (define outlets for
one row)
2) create a view XIB/NIB in Xcode and set it up in IB.
3) In IB make sure you set the File's Owner class to your custom
NSViewController class.
4) Set the view outlet of the File's Owner to your compound view in
the XIB
5) Add other views, controls buttons and wire them to the outlets in
the custom controller.
6) Prepare your main UI by setting up a container view that will host
the compound view and create an outlet for that view (container).
7) In the main controller (the one that embeds the individual rows),
create an instance of your view controller like this:
myViewController = [[MyViewController alloc]
initWithNibName:@"MyViewNib" bundle:nil];
(release it in -dealloc of that class).
8) Embed the compound view in your container using:
[container addSubview:[myViewController view]];
[[myViewController view] setFrame:<WHERE_YOUR_WANT_IT>];
[[myViewController view] setHidden:NO];
9) You can also use NSViewControllers representedObject to wire
bindings or add your own UI management code that loads and saves data.
10) Repeat steps 7-9 for each row you need to display.
In your case you would have an array of MyViewControllers than let you
access the individual rows.
Hope this helps.
Regards
Markus
--
DATE : Tue Jun 24 23:24:55 2008
On Jun 24, 2008, at 1:36 PM, Keary Suska wrote:
> I would have each "row" of controls as a vanilla NSView in a
> separate nib.
> Your controller class, which would be the nib owner, could manage
> each "set"
> of controls. You'll need to familiarize yourself with nib loading
> (particularly NSNib's methods) and the cocoa drawing system
> (particularly
> views and subviews, and the coordinate system), at least. There may
> be more
> that I am not thinking of.
In addition to what Keary Suska said, you can use NSViewController to
manage the custom compound view located it's own NIB. NSViewController
will manage memory, help with bindings and general management.
Basically everyhing you would have to do manually otherwise.
NSViewController is available in 10.5.
See http://developer.apple.com/documentation/Cocoa/Reference/NSViewController_Class/Introduction/Introduction.html
for more information.
The basic steps are these:
1) create a custom NSViewController derived class (MyViewController)
which will manage one row of controls in your UI (define outlets for
one row)
2) create a view XIB/NIB in Xcode and set it up in IB.
3) In IB make sure you set the File's Owner class to your custom
NSViewController class.
4) Set the view outlet of the File's Owner to your compound view in
the XIB
5) Add other views, controls buttons and wire them to the outlets in
the custom controller.
6) Prepare your main UI by setting up a container view that will host
the compound view and create an outlet for that view (container).
7) In the main controller (the one that embeds the individual rows),
create an instance of your view controller like this:
myViewController = [[MyViewController alloc]
initWithNibName:@"MyViewNib" bundle:nil];
(release it in -dealloc of that class).
8) Embed the compound view in your container using:
[container addSubview:[myViewController view]];
[[myViewController view] setFrame:<WHERE_YOUR_WANT_IT>];
[[myViewController view] setHidden:NO];
9) You can also use NSViewControllers representedObject to wire
bindings or add your own UI management code that loads and saves data.
10) Repeat steps 7-9 for each row you need to display.
In your case you would have an array of MyViewControllers than let you
access the individual rows.
Hope this helps.
Regards
Markus
--
| Related mails | Author | Date |
|---|---|---|
| Paul Archibald | Jun 24, 20:21 | |
| Keary Suska | Jun 24, 22:36 | |
| Markus Spoettl | Jun 24, 23:24 |






Cocoa mail archive

