Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone “什么是”呢;“自我”;“那”是怎么回事;“视图”;使用的财产?_Iphone_Objective C_Self - Fatal编程技术网

Iphone “什么是”呢;“自我”;“那”是怎么回事;“视图”;使用的财产?

Iphone “什么是”呢;“自我”;“那”是怎么回事;“视图”;使用的财产?,iphone,objective-c,self,Iphone,Objective C,Self,在这方面: -(IBAction)buttonClick: (id)sender { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Fo Sho?" delegate:self cancelButt

在这方面:

-(IBAction)buttonClick: (id)sender {
    UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:@"Fo Sho?"
                                  delegate:self
                                  cancelButtonTitle:@"Cancel"
                                  destructiveButtonTitle:@"fo sho"
                                  otherButtonTitles:nil];
    [actionSheet showInView:self.view];
}

< P> <代码>“自我/代码>”在许多其他语言(如C++)中等同于<代码> < <代码> >。换句话说,当您调用
[myString length]
时,
length
消息中的
self
指针就是指向名为
myString
的字符串的指针

-(void)logScore
{
    NSLog(@"%@ score is %d", self.name, self.score);
}

[player logScore];

在本例中,
self
player
对象。

投票结束,因为这很可能是重复的:与另一个问题完全相同,也很接近:在我的具体示例中如何?它是UIButton还是UIView或UIViewController?若buttonClick是视图控制器的方法,那个么它将是视图控制器。如果buttonClick是视图的方法,那么它将是视图。它将是您向我们显示的
#buttonClick:
-方法所属的类的实例。很可能是一个
UIViewController
,但由于您没有向我们显示更多的代码,这只是一个猜测