Scroll Views
Scroll Views
- Subject: Scroll Views
- From: Development <email@hidden>
- Date: Fri, 21 Sep 2007 16:33:14 -0700
This photographer is trying to drive me insane.
Ok... The interface is hopefully going to be an NSScrollView. It will
have a certain number of buttons from left to right depending on the
size of the window. Once the width is reached a new line will be
begun. I have no trouble getting the buttons with images in them to
appear in an NSClipView defined in the nib. The problem is... I do
not know how to either resize the clipview or tell the scrollview
that the clip view has resize because what I get is the lines of
buttons that appear to go up above the top of the window and no
scrollbar.
Now I assume I am suppose to set the content view size first, then
begin adding the images. So that is what I've done. The code
currently only adds 1 button per line which is all I care about for
testing. After setting the content size then I would add it to the
scrolleview which is what I must be doing wrong... i think.
Anyway I've made a mess this is the code that doesn't work:
-(void)awakeFromNib
{
[scroller setHasVerticalScroller:YES];
NSString * imagePath =@"/Users/mine/Pictures/DSCF0019.JPG";
int n = 0;
float top = 6.0*140.0;
NSRect scf = [scrollContent frame];
[scrollContent setFrame:NSMakeRect(scf.origin.x,scf.origin.y,
150.0,top)];
while(n !=6){
ThumbNail * thisThumb =[[ThumbNail alloc]initWithFile:imagePath
originx:0.0 originy:top];
[scrollContent addSubview:[thisThumb thumbNailImage]];
top -=140;
n++;
}
[scroller setContentView:scrollContent];
}
I hope maybe some one can shed some light for me.
Thanks
April
_______________________________________________
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