touchUpInside event for uibutton under transparent uiview - uiview

I've uibutton under transparent uiview, how can I determine touchUpInside event?

Set the property userInteractionEnabled of the transparent UIView to NO and it should pass all touches to your UIButtons.

Related

UIControl not receiving touches inside UITableView Cell

I added UIView in storyboard & make it as UIControl's subview. This view is inside UITableViewCell. Now I want to add touch up inside action for UIControl. I have added below code:
[cell.conditionControl addTarget:self action:#selector(btnConditionClick:) forControlEvents:UIControlEventTouchUpInside];
But this code is not working & not receiving any events.
I also disable userInteractionEnabled flag for UIView's Subview.

How to prevent a UILabel from blocking a touch to a parent UIButton in Swift?

I have a UIButton that has four child UILabels that contain information about the button's functionality. When I click the center of the button the action does not fire because it is being blocked by the UILabels but when I click the outside of the button the action does fire. Is there a way to prevent the UILabels from blocking the action firing?
You'll need to set isUserInteractionEnabled = false on any view that is above the button, or a subview of it.
By default UILabel have it set to false, but as you mentioned in the comments, UIStackView does not. So calling isUserInteractionEnabled = false on it will do the trick ┌( ಠ‿ಠ)┘

how to add buttons on CALayer in ios?

How to add UIButtons , UILabels UIImageView on CALayer and perform actions according to the button pressed.Thanks in advance
{
[graphic addSublayer:self.firstButton.layer];
[graphic addSublayer:self.mylabel.layer];
[self.view.layer addSublayer:graphic];
}
I used the above code but when I pressed the button it does not perform any action
Thanks
A CALayer is not an event responder, If you want a button that actually works on top of a CALayer, put that CALayer into a UIView and add a UIButton to that view.

Make UIButton "tappable" in tableView.backgroundView

If you try to add a UIButton as a subview of the backgroundView of tableView you can realize that you can't tap on that button because the backgroundView is below the UITableViewCells even when the table are empty.
Is there a way to make this button tappable?

CALayer didn't response for dragging in TableView

I Have Some CALayers in my TableViewCell, when I touch the layer and start to drag, I found that, I can not drag the table.
Do I have to use an UIView instead of CALayer?
Any sugguestion?
CALayer is not a subclass of UIResponder so they can't handle any touches. Use UIView instead.

Resources