I've got a UIScrollView (scrollView) and a UIImageView (scrollImage). I'm trying to add buttons to a scroll view and have them resize and reposition correctly when I zoom in and out. I had the following code at first to add a button:
[scrollView addSubview:button];
This gave me problems with zooming in and out. The position of the buttons wouldn't stay relative to the image. So i changed it to this:
[scrollImage addSubview:button];
Which made everything zoom 开发者_如何学Pythonin and out nicely, however the buttons have stopped reacting to touches (I assume because they are beneath the UIScrollView).
Is there a way to have both features working correctly?
Thanks Zac
By default a UIImageView has userInteractionEnabled set to NO. Set it to YES and you should be fine.
try by setting like this,
scrollImage.userInteractionEnabled=YES
精彩评论