开发者

How to use UIScrollView with complex picture

开发者 https://www.devze.com 2023-01-25 13:52 出处:网络
I have a c开发者_高级运维omplex picture . It consists of several layers. Each layer is a picture .

I have a c开发者_高级运维omplex picture . It consists of several layers. Each layer is a picture . for example , background picture -> man picture -> gun picture -> foreground picture I want drag and use pinch gesture with complex picture . Can i do it with UIScrollView ?


What happens if you make all the UIImageViews of your complex picture and put them in a UIScrollView (I'm assuming that you've tried this before asking your question?)

i.e from inside a view controller :

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    UIImageView *i1 = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"backgoround.png"]] autorelease];
    UIImageView *i2 = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"man.png"]] autorelease];
    UIImageView *i3 = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gun.png"]] autorelease];

    UIView *v = [[[UIView alloc] initWithFrame:[[self view] bounds]] autorelease];
    [v addSubview:i1];
    [v addSubview:i2];
    [v addSubview:i3];

    return v;
}
0

精彩评论

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