开发者

How to display two UIImages one over another

i have to display two images one below the other. The images should look as if one is overlapping another(more over like a 3d image). i am using(i must use) drawRect method to display the images. i am even putting a code snippet that im using... Ca an开发者_C百科yone guide me regarding this. Your inputs would help me go a long way.. Thank you.

*Here coverRect contains an image and UIImage *s is also a image...

if (columnIndex == 1) {
            coverRect = CGRectMake(41,77 ,120 ,150 );

            textRect =  CGRectMake(31, 190 ,120 ,15 );
            if (rowIndex != 0 && currentlyInEditingMode == NO) {
                UIImage *s = [UIImage imageNamed:@"tray_center.png"];
                [s drawInRect:CGRectMake(0, 0, s.size.width, s.size.height)];
            }
        }


Use the following API,

drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha

and for the above image set the alpha value according the opacity value you require. And set the 1.0 as the alpha value for the below image.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜