0

I've searched far and wide across the internet, but to no avail. Basically, I have a viewController that is presenting a UIImagePickerController every time it appears (in viewWillAppear). I'm using a custom camera overlay (xib file) for the UIImagePickerController. Everything is working fine, I can get the camera overlay to appear and I can see all of my buttons on the camera overlay, but none of the buttons are working/responding to any touch events. I've connected the buttons to the viewController using

-(IBAction)buttonName:(id)sender {
    NSLog(@"This button doesn't work");  //to test the button
}

but for some reason I'm encountering this problem. Any thoughts?

Faisal Ali
  • 1,135
  • 10
  • 17
Tony
  • 31
  • 7
  • I created the buttons in xib, then connected them by clicking/dragging to the view controller. – Tony Apr 19 '14 at 04:17
  • It might be possible that buttons are not on top of all views. Can you try to add them with code instead of nib and check? –  Apr 19 '14 at 04:37
  • 3
    Usually this symptom is caused by the buttons being outside the bounds of their superview. To check this, you can either give their superview a background color, or set its clipsToBounds property to YES (and see if the buttons disappear). – rdelmar Apr 19 '14 at 04:52
  • I set clipsToBounds to YES and they all disappeared, but I'm a little confused now because I'm not sure how that happens. Is it that I created the buttons outside the bounds in interface builder, or does it have to do with something else? – Tony Apr 19 '14 at 05:01
  • So I realize now that the buttons being outside the bounds of the superview is the problem and I tried setting the bounds programatically just to see what would happen and I can see part of the buttons, and they work. I don't know how to make sure that the bounds encompass the whole screen so that all the buttons are included though. Basically, how can I set the bounds to include the whole camera overlay? – Tony Apr 19 '14 at 05:30

0 Answers0