2009年6月19日星期五

Object-C StudyNote-1

Method:
.. Behavior associated with an object

-(NSString *) name
{
// implementation
}
-(void)setName:(NSString *) name
{
//implementation
}

selector --有点引用的意思
. name for referring to a method
. include colons to indicate arguments
. Doesn't actually include arguments or indicate types
SEL mySelector = @selector(name);
SEL anotherSelector = @selector(setName:);
SEL lastSelector = @selector(doStuff:withThing:andThing:);

Message
. the act of performing a selector on an object
. with arguments, if necessary
NSString * name = [myPerson name];
[myPerson setName:@"New Name"];

没有评论:

发表评论