uibutton

UIButton with custom view - addTarget:action:forControlEvents: does not work

こ雲淡風輕ζ 提交于 2020-08-06 10:59:43
问题 My button is as follows Created label1 Created label2 Created customView ( UIView ) Added label1 and label2 on custom view Created myCustomButton( UIButton ) Added customView on myCustomButton I have already done userInteractionEnable for custom_View, label1 and label2. Then added [myCustomButton addTarget:self action:@selector(OnButtonClick:) forControlEvents:UIControlEventTouchUpInside]; And -(void)OnButtonClick:(UIButton *)sender { } But above function is never called even when I touch the

UIButton with custom view - addTarget:action:forControlEvents: does not work

我们两清 提交于 2020-08-06 10:59:42
问题 My button is as follows Created label1 Created label2 Created customView ( UIView ) Added label1 and label2 on custom view Created myCustomButton( UIButton ) Added customView on myCustomButton I have already done userInteractionEnable for custom_View, label1 and label2. Then added [myCustomButton addTarget:self action:@selector(OnButtonClick:) forControlEvents:UIControlEventTouchUpInside]; And -(void)OnButtonClick:(UIButton *)sender { } But above function is never called even when I touch the