0

I have a subview on the screen that is loaded from a XIB, I need to disable touch events ONLY on its superview while not touching the subview in the end. How would I do this? Also, I am using iOS.

Thanks!

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191

3 Answers3

2

This is how you can go about doing this -

  1. Go to interface builder & select your superview (for which you want to disable touches).
  2. Open right navigation bar. At the bottom there is a checkfield called "User Interaction Enabled". You can unmark it. Of course you can go about doing this from code too. But this is more graphic. This screenshot might help. See bottom of the image...

enter image description here

Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
1

I am also new to iphone development but htis piece of code helped me out when i tried to move only UIImage view.

you can apply cahnges on this code if you are using buttons or labels in your view.

if ([touch.view isKindOfClass:[UIImageView class]])

{
    imageDemo.center = touchLocation;
}
Iphone Developer
  • 163
  • 2
  • 14
1

In XIB, rather than using all other views as subview, u can just use superview at same level and set its usertouch interface as FALSE.

Baby Groot
  • 4,637
  • 39
  • 52
  • 71