• 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
Framing a UIImageView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Framing a UIImageView


  • Subject: Framing a UIImageView
  • From: Development <email@hidden>
  • Date: Wed, 9 Sep 2009 18:54:51 -0700

I'm trying to stroke a rect around a UIImage. I have subclassed UIImageView with the following code but I get Nothing the drawRect: method is never called:

-(id)initWithImage:(UIImage *)image
{
	if(self= [super initWithImage:image])
	{

	}

	return self;
}

-(void)setSelected
{
	selected = YES;
	[self setNeedsDisplay];
}

-(void)deselect
{
	selected = NO;
	[self setNeedsDisplay];
}



- (void)drawRect:(CGRect)rect
{
	NSLog(@"ImageView Draw");
	[super drawRect:rect];
	if (selected) {
		CGContextRef ctx = UIGraphicsGetCurrentContext();


		CGContextSetRGBStrokeColor(ctx, 1.0, 1.0, 1.0, 1);
		CGContextStrokeRect(ctx, self.frame);
	}
	else{
		CGContextRef ctx = UIGraphicsGetCurrentContext();


		CGContextSetRGBStrokeColor(ctx, 1.0, 1.0, 1.0, 0.0);
		CGContextStrokeRect(ctx, self.frame);
	}

}
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Prev by Date: Scripting Bridge link error
  • Next by Date: Re: Scripting Bridge link error
  • Previous by thread: Re: Scripting Bridge link error
  • Next by thread: Re: Framing a UIImageView
  • Index(es):
    • Date
    • Thread