How can I add UIView touchbegin action or touchend action programmatically as Xcode is not providing from Main.storyboard?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- SwiftUI: UIImage (QRCode) does not load after call
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Using if let syntax in switch statement
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Enum with associated value conforming to CaseItera
- Swift - hide pickerView after value selected
- Is there a Github markdown language identifier for
For swift 4
Just an update to above answers :
If you want to have see changes in the click event, i.e. Color of your UIVIew shud change whenever user clicks the UIView then make changes as below...
Also, call this Class from Storyboard & ViewController as:
Updating @Chackle's answer for Swift 2.x:
Updating @stevo.mit's answer for Swift 4.x:
You will have to add it through code. Try this:
Swift 4.2: