Error reporting and resolution of #selector above swift5
The version of swift has changed a lot recently. If you add an event to a button, you must be very skilled in OC. How do you define functions and pass parameters in
swift
let btn = UIButton()
btn.tag = 2
btn.addTarget(self, action: #selector(buttonClick(button:)), for: .touchUpInside)
@objc func buttonClick(button: UIButton) {
button.isSelected = true
print(btn.tag!)
print("\(btn.tag)")
}
The custom method must be preceded by @ objc to follow the OC mechanism, otherwise an error will be reported
Read More:
- Eslint error reporting and resolution
- Swift error: abort trap: 6
- “View inheritance may not use attribute ‘string‘ as a selector.
- IOS swift error
- Swift fatal error: unexpectedly found nil while unwrapping an Optional value?
- Error reporting – the project directly introduces the error reporting and solution of. SCSS file
- swift stdlib tool error is reported after xcode upgrade xcode9 1
- Error domain = nsurlerrordomain code = – 1001 “request timeout occurred in swift alamofire get request. ” UserInfo={NSUnderlyingErro
- Swift Error fatal error: unexpectedly found nil while unwrapping an Optional value
- After NPM run dev is running, the browser does not respond and reports an error in. / ~ / Babel loader / lib! / ~ / Vue loader / lib/ selector.js?type=script&in
- After using fastlick, double-click the error reporting solution
- Android dependency conflict resolution
- Error reporting of eslint in webstorm
- Microsoft fix 50688 [Windows 7 event ID10, WMI error resolution
- Brief introduction of idea Lombok and solutions for reporting red and wrong
- Error reporting using NVIDIA SMI
- Error resolution of ‘string’ does not name a type
- git remote: HTTP Basic: Access denied error resolution
- Several solutions to HDF5 error reporting in Python environment
- Element add font packaging error resolution