2008年2月27日 星期三

interface builder and nib

use interface builder to create GUI

nib:(NeXT interface builder): created by interface builder

double-click on nib file will open interface builder. Then you can modify GUI

outlet: an instance variable that points to other object
when a object A want to send messages to another object B, it must defined B as its outlet
outlet is defined as IBOutlet:
ex: IBOutlet NSTextField textfield;

action: 要做的事情
action is defined as IBAction
ex: (IBAction) action: (id) sender


設定outlet and action:
ctrl+ mouse
If A want to send messages to B, connect from A to B

how to create a object in interface builder:
define class' header
In Interface builder, choose File-> read class files , choose class' header file
move object from library to mainMenu.nib
change object's class to your class name( under class identify)

沒有留言: