UIView 插入到 UIWebView 的滚动视图中,在横向模式下不可点击 [英] UIView inserted into UIWebView's scrollview, is not clickable in landscape mode
问题描述
所以基本上,出于 .当旋转回纵向时,灰色再次显示并且可以点击
为滚动视图提供背景颜色以查看它的位置.如果按钮在滚动视图之外,它仍然可见(如果 clipsToBounds
是 NO
,默认情况下)但不可点击.
找出按钮的superview在哪里,调整大小,使其大小足够大.
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).
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
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.
这篇关于UIView 插入到 UIWebView 的滚动视图中,在横向模式下不可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!