iPhone: adding button to scrollview makes button inaccessible to interaction

后端 未结 2 1665
傲寒
傲寒 2021-01-21 03:15

For some reason, the button initialized in the addBook method of my viewController won\'t respond to touches. The selector I\'ve assigned to it never triggers, nor does the UICo

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-21 03:39

    THe UIScrollView might be catching all the touch events.

    Maybe try a combination of the following:

    _scrollView.delaysContentTouches = NO;
    _scrollView.canCancelContentTouches = NO;
    

    and

    bookView.userInteractionEnabled = YES;
    

提交回复
热议问题