iPhone: subclassing UIView for blendmode
iPhone: subclassing UIView for blendmode
- Subject: iPhone: subclassing UIView for blendmode
- From: "Eric E. Dolecki" <email@hidden>
- Date: Fri, 22 Jan 2010 09:49:39 -0500
Sorry this is a noob question, but I am try to get blendmode to work for
images. What I have done so far that seems to do nothing:
I create a new class called ImageView which subclasses UIView. I have done
nothing in the initWithFrame, only in drawRect:
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetBlendMode(context, kCGBlendModeMultiply);
}
In my view controller, I import the class and then call it up and use it
like so (in a table):
if( cell == nil ){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero
reuseIdentifier:MyIdentifier] autorelease];
projectImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40,
40)];
projectImageView.backgroundColor = [UIColor clearColor];
projectImageView.tag = 5;
*//We need to use a custom class for the image so we can set it's blendmode
to multiply.*
ImageView *myUIView = [[ImageView alloc] initWithFrame:CGRectMake(2, 2, 40,
40)];
[myUIView addSubview:projectImageView];
[cell.contentView addSubview:myUIView];
...
I am not seeing the blend mode applied - it seems nothing is happening. Do I
need to call a method of my own after I add the subView to the subclassed
UIView in order for it to take? I think I am missing something very basic
here.
Thanks for any help,
Eric
_______________________________________________
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