On Mon, Jun 17, 2013, at 08:20 AM, Keary Suska wrote: > On Jun 17, 2013, at 8:38 AM, Keary Suska wrote: > > > NSScrollView* myscrollview = [[NSScrollView alloc] > > initWithFrame:NSMakeRect(0, 0, 200, 200)]; > > NSClipView* myclipview = [[NSClipView alloc] initWithFrame:NSMakeRect(0, > > 0, 500, 400)]; > > [myscrollview setHasVerticalScroller:YES]; > > [myscrollview setHasHorizontalScroller:YES]; > > [myscrollview setDocumentView:myclipview]; > > > > [[myscrollview documentView] scrollPoint:NSMakePoint(300.0, 300.0)]; > > > > [self.window.contentView addSubview:myscrollview]; > > > It may also be useful to mention that this code is all wrong. > NSScrollView creates its own NSClipView, which is its contentView. > NSClipView, AFAIK, will not function well as a standard view.
Yes, _this_ is the actual problem. It is perfectly fine to use -scrollPoint: to scroll a view, once you've set up the scroll view hierarchy correctly. NSScrollView exposes its (self-created) clip view via the contentView property. The documentView property is for _your own_ view; NSScrollView inserts it into the clip view on your behalf. This might have been clearer if you had used Interface Builder instead of trying to build your scroll view in code; in that case, IB wouldn't even show you the clip view at all. Consider reviewing the Scroll View Programming Guide for Mac: https://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/NSScrollViewGuide/Articles/Introduction.html --Kyle Sluder _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com