IOS - UIButton on UIPageControl not working

I use UIPageControl as an indicator between the different pages (view controllers) of my application. In each of the view controllers, I need to have a different button in the left corner of the UIPageControl. If I put a UIButton in this position on each of the view controllers, I see it on the UIPageControl , but the buttons do not respond to the touch event. Is there something I'm missing? Or is there an alternative? Thanks.

0
source share
1 answer

I think the page control and view controller view are both representations of the same view. In this case, the button is displayed outside the visibility of the view manager. This is enabled by default, but it has a side effect in which the button cannot be activated because the supervisor cannot handle the touch.

You must have buttons on the page control that belong to the super view controller (the controller that owns the root view that contains the page control and child controllers). Then, when the button is pressed, it must inform the controller of the child view so that it can take appropriate action.

+2
source

Source: https://habr.com/ru/post/912755/


All Articles