NSLog(@"%@", [scrollView documentView]); //outputs (null)

What does NSLog(@"%@", scrollView ); tell you ?

// the following is a memory leak if you are not using garbage collection
[scrollView setDocumentView:[[NSView alloc]  initWithFrame:NSMakeRect(0, 0, 
500, 500)]];

Try 
[scrollView setDocumentView:[[[NSView alloc]  initWithFrame:NSMakeRect(0, 0, 
500, 500)] autorelease]];

If scrollView is not nil, the above code will do what you want except that an 
instance of plain NSView doesn't draw anything so the scroll view will look 
empty with scroll bars appropriate for a 500 by 500 document view.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to