• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CustomView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CustomView


  • Subject: Re: CustomView
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 2 May 2005 11:02:13 -0400
  • Organization: Rogue Research

On 2005-04-29 10:56, R T said:

>Created CustomView in IB and I want to change its
>size,location and color it.
>
>I have an instance variable...
>
>#import <Cocoa/Cocoa.h>
>@interface MyPixelFinder : NSImageView
>{
>	IBOutlet NSView *oppView;
>	NSRect oppBounds;
>}
>@end
>
>and here is the block of code I've tried...
>
>oppBounds =  NSMakeRect(406, 525, 50, 100);
>[[oppView superview] setNeedsDisplayInRect:[oppView
>frame]];	[oppView setFrame: primBounds];
>[oppView lockFocus];
>[NSBezierPath bezierPathWithRect:oppBounds];
>pixelColor = [NSColor redColor];
>[pixelColor set];
>NSRectFill(oppBounds);
>[oppView unlockFocus];
>[oppView setNeedsDisplay:YES];

Where is this block of code run from?  Remember IBOutlet's like oppView
are only valid starting in awakeFromNib.  Also don't call things like
setNeedsDisplay: from your drawRect: method.

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


 _______________________________________________
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

  • Prev by Date: Re: Some more debugging questions...
  • Next by Date: Re: NSStepper and notification
  • Previous by thread: Re: Spotlight Plugins don't immediately work?
  • Next by thread: Re: NSStepper and notification
  • Index(es):
    • Date
    • Thread