CAShapeLayer plus UIBezierPath draws an oblique line. You can"t click on it. Ask the boss for advice
CAShapeLayer plus UIBezierPath draws an oblique line. You can"t click on it. Ask the boss for advice
on his parent view UIView, respond to the gesture.
because UIView can respond to events, CALayer cannot.
UIKit uses UIResponder as the response object to respond to and process events passed by the system. UIApplication, UIViewController, UIView, and all subclasses of UIView (including UIWindow) are responders responder, through inheritance.
the interface for handling various events and event delivery is defined in UIResponder, while CALayer inherits NSObject directly and has no corresponding interface for handling events.
on the official document, it is written very clearly
https://developer.apple.com/d...
Layer is designed not to respond to events, so you need to respond to events, handle them in the touch event in view, or add your own gestures
for example, if a button becomes unavailable after it is clicked, it can not be clicked until the next day, so the button can only be clicked once a day, such as check-in, so how to update the status of the button at zero? ...
after collectionview adds a cell, but closes the APP, what do you want to do with the data source when you open the cell, and find that it has not been added? ...