Is it possible to to hard code the IBAction
s and IBOutlet
s in code, instead of drag-connecting them in Interface Builder?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- back button text does not change
- iOS (objective-c) compression_decode_buffer() retu
- how to find the index position of the ARRAY Where
相关文章
- 现在使用swift开发ios应用好还是swift?
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- didBeginContact:(SKPhysicsContact *)contact not in
- Custom Marker performance iOS, crash with result “
Yes it is poosible...
sample code
The concept and sole purpose of IBAction and IBOutlet is to provide Interface Builder with means to connect the xib with your code.
If you don't want to use Interface Builder with your code, you don't need IBAction or IBOutlet, you need them ONLY to use objects (buttons, textfields, etc.) that were instanciated in your xib from your classes.
With that said, mihirpmehta's answer is the correct way to programmatically add UI elements to your view and add actions to them.