iphone - grouping UIImageViews x blocking elements
Posted
by Mike
on Stack Overflow
See other posts from Stack Overflow
or by Mike
Published on 2010-04-16T15:23:02Z
Indexed on
2010/04/16
15:33 UTC
Read the original article
Hit count: 246
I have to rotate several UIImageViews around a specific center. To accomplish this I am using the famous trick of putting these views as subviews of a larger one and rotating that one.
The problem is that these subviews have to detect touches, because each one has buttons on it.
The hierarchy is like this
LARGE_VIEW
|
|_____ imageView1
| |_________ button1
| |_________ button2
| |_________ button3
|
|_____ imageView2
|_________ button4
|_________ button5
|_________ button6
etc
So, to make buttons respond to tap, I had to make this;
[LARGE_VIEW setUserInteractionEnabled:YES];
[imageView1 setUserInteractionEnabled:YES];
[imageView2 setUserInteractionEnabled:YES];
ImageView1 and 2 are two vertical rows of buttons on each side of the screen.
The problem is that there's another view below LARGE_VIEW and this view is not receiving the taps, because LARGE_VIEW is intercepting them first.
I don't need LARGE_VIEW to detect any taps except on the two areas where imageView 1 and 2 are. LARGE_VIEW must let pass taps on the area defined by this rect (52, 0, 768-2*52, 1024).
ImageView1 and 2 have this size: 52 pixels wide and 1024 pixels high (iPad). ImageView1's rect is: (0, 0, 52, 1024) and ImageView2's rect is: (768-52, 0, 52, 1024)
LARGE_VIEW must let pass taps on the area defined by this rect (52, 0, 768-2*52, 1024).
How to solve that? I need LARGE_VIEW detect taps on each rect defined on my previous paragraph and pass these taps to its subviews and just let pass taps outside these rects to the app, so other views BELOW, can detect taps too.
thanks.
© Stack Overflow or respective owner