When I use loadNibNamed method to load a xib file, how to pass some parameter?
[NSBundle loadNibNamed:xibName owner:[NSApplication sharedApplication]];
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.
In order to pass parameters when instantiating your class, add a wrapper to the
loadNibNamed:owner:method and pass your parameters to this wrapper.Here is the code snippet for this:
Here P1 and P2 are your class level variable corresponding to param1 and param2. Now you can use them anywhere in the code.