PDA

View Full Version : Modify NIB using XCode




satyam90
Nov 27, 2007, 12:42 AM
Hi, I am using XCode 2.4.1 with OBJ - C (Cocoa framework)
I have created an application with all required NIB's and implemented all its functionality. Its working fine.
Now my boss asked me to put a Checkbox(NSButton) and implement its functionality in a dialog.

I know how to do it in a dialog from scratch and create necessary classes (files). Now when I try to add a checkbox, its attributes and actions, all the functionality of the classes(files) will be over written. So, how can I add a new Button to a dialog now.

Thanks in advance.

satyam.



HiRez
Nov 27, 2007, 02:42 AM
Now my boss asked me to put a Checkbox(NSButton) and implement its functionality in a dialog.

I know how to do it in a dialog from scratch and create necessary classes (files). Now when I try to add a checkbox, its attributes and actions, all the functionality of the classes(files) will be over written. So, how can I add a new Button to a dialog now.Why would everything else be overwritten? Changing the nib should not be changing code in your class files. Just add the necessary actions to your controller class, drag the .h header back into Interface Builder, and connect the actions. And if you aren't using Cocoa Bindings, you should be; they can typically reduce the code you need to write for such things to near zero.

satyam90
Nov 27, 2007, 03:55 AM
when NIB is ready and classes(files) are created, I am adding my own variables and functions(methods) as per my requirement. Now when I change dialog and create classes(files) again, it is showing message box to overwrite or merge.

Sijmen
Nov 27, 2007, 09:47 AM
when NIB is ready and classes(files) are created, I am adding my own variables and functions(methods) as per my requirement. Now when I change dialog and create classes(files) again, it is showing message box to overwrite or merge.

Ah, like that.

Just add the new outlets and actions in code, then re-read the files in Interface Builder (right click the class, then read headers).