Re: NSScrollView setDocumentView: problem with NSView subclass
Re: NSScrollView setDocumentView: problem with NSView subclass
- Subject: Re: NSScrollView setDocumentView: problem with NSView subclass
- From: John Pannell <email@hidden>
- Date: Wed, 20 Jul 2005 19:03:41 -0600
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