I need to create IBOutlet and IBActions without using Interface Builder.
How can I do?
I need to create IBOutlet and IBActions without using Interface Builder. How can I
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure how you’re planning on connecting an IBOutlet or an IBAction without a backing nib, but you can create the needed bits manually.
IBActions are just interface builders way of decorating a selector contract with an implementation. You can manually create a method bound to a selector with the following code example:
IBOutlets are just interface builders way of decorating instance variables (ivars). Ivars are exposed by the monotouch code generator as properties, so that we can lazily query the native proxy backing store and dont need to marshal the value at every transition point. You can manually create a instance variable on the proxy class with the following code example:
Astute readers will notice that the MT code generator generates slightly different code:
If you dangle any state off the object you are storing in the native field, you will need to use this construct as well, so the garbage collector sees the reference.