什么是“自我”?以及“观点”如何?使用的财产?
在此:
-(IBAction)buttonClick: (id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Fo Sho?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"fo sho"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
}
UIButton 将链接到此“buttonClick”IBAction,但什么是“self”?
In this:
-(IBAction)buttonClick: (id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"Fo Sho?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"fo sho"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
}
A UIButton would be linked to this "buttonClick" IBAction but what is "self"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
self
相当于许多其他语言(例如 C++)中的this
。换句话说,当您调用[myString length]
时,length
消息内的self
指针是指向名为myString的字符串的指针
。在示例中,
self
是player
对象。self
is the equivalent tothis
in many other languages such as C++. In other words when you call[myString length]
, theself
pointer inside thelength
message is the pointer to your string namedmyString
.In the example,
self
is theplayer
object.