Re: NSScrollView setDocumentView: problem with NSView subclass
Re: NSScrollView setDocumentView: problem with NSView subclass
- Subject: Re: NSScrollView setDocumentView: problem with NSView subclass
- From: Matt Ball <email@hidden>
- Date: Wed, 20 Jul 2005 22:43:02 -0400
No. "imageView" is an NSView subclass that is going to have several
images and effects composited into it. For various reasons, I've
determined that an NSView subclass will be easier to work with than a
simple NSImageView.
So is there any reason why my NSView subclass wouldn't be getting
drawn? Do I somehow need to tell the compiler that it is an NSView in
order for things to work properly?
- Matt Ball
On 7/20/05, John Pannell <email@hidden> wrote:
> Hi Matt-
>
> I don't think your view is allocated correctly... in the following
> line...
>
> theImageView = [[imageView alloc] initWithFrame:NSMakeRect
> (20,20,300,200)];
>
> I think you meant [NSImageView alloc] instead of [imageView alloc].
>
> HTH!
>
> John
>
> On Jul 20, 2005, at 6:18 PM, Matt Ball wrote:
>
> > I've got an NSScrollView (added with IB) in my app. I've got an NSView
> > subclass that I am trying to add as the scrollView's documentView, but
> > I keep getting the following warning:
> >
> > "Passing argument 1 of 'setDocumentView:' from incompatible pointer
> > type."
> >
> > Here's my code:
> >
> > // scrollViewController.h
> >
> > @class imageView;
> >
> > @interface imageViewController : NSObject
> > {
> > IBOutlet id scrollView;
> > imageView *theImageView;
> > }
> >
> > // scrollViewController.m
> >
> > - (void)dealloc {
> > [theImageView release];
> > [super dealloc];
> > }
> >
> > - (void)awakeFromNib {
> > theImageView = [[imageView alloc] initWithFrame:NSMakeRect
> > (20,20,300,200)];
> > [scrollView setHasHorizontalScroller:YES];
> > [scrollView setHasVerticalScroller:YES];
> > [scrollView setScrollsDynamically:YES];
> > [scrollView setDrawsBackground:YES];
> > [scrollView setBackgroundColor:[NSColor
> > colorWithCalibratedWhite:0.4
> > alpha:1.0]];
> > [scrollView setDocumentView:theImageView];
> > }
> >
> > Does anyone have an insight into why I am getting this error? (The
> > NSView subclass never shows up in the window, by the way). Thanks.
> >
> > - Matt Ball
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Cocoa-dev mailing list (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> > 40positivespinmedia.com
> >
> > 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