.. 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"];
没有评论:
发表评论