0

so basically, for reasons in this answer ive put a UIView inside a webview so that it acts as a header to the view. its works perfectly for ipad, but on iphone when the webview is rotated landscape, the header UIView isnt clickable.

ive tried in the - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation to explicitly set the userInteraction = true of the header view but this didnt work.

i tried removing it from the superview and adding it back, but to no avail.

i have some debug code that lets me see the class of the view im clicking on, and when i click on the header view i can see its clicking on the scrollview behind it (which is part of the webview). so it just seems to be ignoring the view completely (even though it works in portrait mode, and works in landscape and portrait on ipad).

enter image description here enter image description here

does anyone know why the click events are going straight though the uiview?

update:

something interesting ive found is that if the webview doesnt resize when the view rotates, then the header is still clickable, so it must be something to do with the resizing of the webview screwing things up

also, the background from the scrollview is like coming through the header view it seems (header = grey, scrollview = yellow) pics here. when rotated back to portrait the grey shows up again and is clickable

Community
  • 1
  • 1
Fonix
  • 11,447
  • 3
  • 45
  • 74

2 Answers2

1

Give the scroll view a background color to see where it is. If the button is outside of the scroll view it is still visible (if clipsToBounds is NO, which it is by default) but not clickable.

Find out where the superview of the button is and make the resizing in a way that it is big enough after resizing.

dasdom
  • 13,975
  • 2
  • 47
  • 58
  • yeah something funky is going on, the background from the scrollview is like coming through the header view it seems (header = grey, scrollview = yellow) http://imgur.com/a/sqbCj when rotated back to portrait the grey shows up again and is clickable – Fonix Jul 31 '13 at 08:31
  • Show me please the autoresizing mask of the header view. And the scroll view. – dasdom Jul 31 '13 at 08:43
  • ive used `view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;` and ive tried just setting the frame in `- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation` both have the same effect – Fonix Jul 31 '13 at 08:52
  • ah ok, i think i fixed it (who knows why this worked) i set the autosizing mask to not stretch downward and that seemed to give it the self esteem to let me click its buttons – Fonix Jul 31 '13 at 09:05
0

strangest solution, but instead of having the header view autoresize in all directions, i set it like so enter image description here

something strange must have been happening and making its frame set wrong somehow

Fonix
  • 11,447
  • 3
  • 45
  • 74