ios - UITabBar / UITabBarController Blocking Touches When Scrolled Away -
i have custom subclass of uitabbarcontroller
adapts delegate has function shift tabbar's frame (specifically frame.origin.y
). when offset equal height of screen (that is, hidden off-screen) have uiscrollview
extending bottom of screen. within uiscrollview
, cannot receive touches in initial frame of tabbar view.
i have seen recommendations add intractable subviews uitabbar
or controller's view. far elegant, , creates multitude of design issues when working views possibly take whole screen. have checked out little public implementation code of uitabbarcontroller
, uitabbar
nothing saw there shows how blocking touches.
i'm aware of recursive nature of hit tests, short of overriding hit test , rerouting touch in uitabbarcontroller
subclass, seems rather unclean, can't think of generic way handle this. question dives apple's uitabbarcontroller
/ uitabbar
implementation, have included relevant code clarity:
class tab_bar_controller: uitabbarcontroller, uitabbarcontrollerdelegate, tab_bar_setter //has included function { //.... irrelevant implementation func shift(visibility_percent: cgfloat) -> cgfloat //returns origin { self.tabbar.frame.origin.y = screen_size().height - (visibility_percent * self.tabbar.frame.size.height) self.tabbar.userinteractionenabled = visibility_percent != 0 //no effect //self.view.userinteractionenabled = visibility_percent != 0 //blocks touches within screen.bounds return self.tabbar.frame.origin.y } }
Comments
Post a Comment