Programatically creating scroll view
Programatically creating scroll view
- Subject: Programatically creating scroll view
- From: April Gendill <email@hidden>
- Date: Mon, 29 Mar 2004 19:34:16 -0700
Right now I'm writing a little tester app that I'll use as a learning
experience before I get into the actual program this is for. Anyway. I
have one real item, the window and it is connected up in ib. For the
most part this code works. I'm in need of correcting the rectangles but
that is secondary to getting it to work the way I'd like.
2 things. 1 the whole window is white there is not frame around the
scroll view, something I'd like to correct. I would actually like the
scroll to set inside the window several pixels from the top sides and
bottom. 2 I need the tabview within the scrollview to resize
horizontally and veritcally and I'm not sure I understand how to make
it do that.
Here is the full awake from nib.
-(void)awakeFromNib
{
NSRect scr = NSMakeRect(20,20,420,540);
NSRect tab = NSMakeRect(0,0,444,536);
NSTabView * theTabs = [[NSTabView alloc]initWithFrame:tab];
[theTabs setTabViewType:NSRightTabsBezelBorder];
[theTabs setAutoresizingMask:NSViewWidthSizable];
int i=0;
while (i <20){
NSTabViewItem * item = [[NSTabViewItem alloc]init];
[theTabs addTabViewItem:item];
i++;
}
scroll =[[NSScrollView alloc]initWithFrame:scr];
[scroll setFrame:scr];
[scroll setPostsFrameChangedNotifications:YES];
[scroll setAutoresizesSubviews:YES];
[scroll setScrollsDynamically:YES];
[scroll setHasHorizontalScroller:YES];
[scroll setHasVerticalScroller:YES];
[scroll setDocumentView:theTabs];
//[testWindow setContentSize:[scroll contentSize]];
[scroll setAutoresizingMask:NSViewWidthSizable];
[testWindow setContentView:scroll];
}
The reason that I have am adding all those tab views is to give the
scrollview something to scroll. Like I said fundamentally this works
but there are the two tweeks I'd like to be able to do
_______________________________________________
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.