Re: addSubviews: How can I populate the first tier of the Container View only?
Re: addSubviews: How can I populate the first tier of the Container View only?
- Subject: Re: addSubviews: How can I populate the first tier of the Container View only?
- From: Andy Kim <email@hidden>
- Date: Sat, 19 Nov 2005 01:09:31 -0800
From documentation of NSBox class:
> An NSBox also has a content view to which other views can be
added; it thus offers a way for an application to group related views.
So you might want to add the subviews with a [[gvContainerView
contentView] addSubview:aView]
- Andy Kim
On Nov 18, 2005, at 5:29 PM, Frederick C. Lee wrote:
Greetings:
I'm trying to populate a container (NSBox) with NSImageViews in a
row/column fashion. I'm using the [containerView addSubview]
method. But I'm noticing that I'm drilling deeper into abyss
rather than just having all subviews on one (1) tier as follows:
/Container <-- actual.
/Subview #1
/Subview #2
/Subview #3
versus...
/Container
/{Subview1, Subview2, Subview3,....} <-- desired.
Question: How can I just populate a single tier subView array of
the container?
The following is my code:
- (IBAction)addSubView:(id)sender {
NSRect myRect;
myRect.origin.x = 10; myRect.origin.y = 10;
myRect.size.width = 60; myRect.size.height = 60;
// This keeps drilling deeper.
for (unsigned k = 0; k < 3; k++) {
[[thumbNailMArray objectAtIndex:k] setFrame:myRect];
[gvContainerView addSubview:[thumbNailMArray
objectAtIndex:k]];
myRect.origin.x += 70;
}
[gvContainerView setNeedsDisplay:YES];
return;
}
Via Debugger: --- keeps getting deeper.
(gdb) po [[[gvContainerView subviews] objectAtIndex:0] subviews]
<NSCFArray 0x39a430>(
<NSImageView: 0x396a30>
)
(gdb) po [[[[gvContainerView subviews] objectAtIndex:0] subviews]
objectAtIndex:0]
<NSImageView: 0x396a30>
(gdb) po [[[[[gvContainerView subviews] objectAtIndex:0] subviews]
objectAtIndex:0] subviews]
<NSCFArray 0x384c80>(
)
_______________________________________________
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
_______________________________________________
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