Framing a UIImageView
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