开发者

Drawing in Custom ScrollView

开发者 https://www.devze.com 2023-03-01 09:36 出处:网络
I\'m trying to draw in a scrollview on top of an image using multi-touch.The circles are actually drawn, but under the image. In my code I currently create a custom ScrollView:

I'm trying to draw in a scrollview on top of an image using multi-touch. The circles are actually drawn, but under the image. In my code I currently create a custom ScrollView:

@interface AppScrollView : UIScrollView {

//objects to draw circles
NSMutableDictionary *circlesInProcess;
NSMutableArray *completeCircles;

}

@end

In my AppScrollView.m I override touches commands to store touches and add a

    (void)drawRect:(CGRect) rect  

method to draw the circles in the scrollview. I also include

    [self setNeedsDisplay] 

to display the circles. In my app controller, I declare the new custom scrollView object:

    IBOutlet AppScrollView *scrollView;

Later I add an image to the scrollView using:

    [scrollView addSubview:myImage];
开发者_开发知识库

The image is visible, but when I try to draw circles on top of it, they are drawn under the image. Let me know if you have any suggestions?


Suggestion: draw the image onto your scrollview (instead of adding the image view as a subview) and then draw the circles on top of that.


In your code check where did you add you custom scrollview. Is it added after imageView is added or before.

You scrollView should be on top of imageView.

0

精彩评论

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