所以我在我正在學習的書上有這塊代碼。這個獨立的{}
實際上做了什麼?獨立大括號在Objective-C中做了什麼?
self = [super initWithImageNamed:@"character.png"];
{
self.name = playerName;
self.zPosition = 10;
}
是從
self = [super initWithImageNamed:@"character.png"];
self.name = playerName;
self.zPosition = 10;
它假設是'self = [super init ...];如果(自己){...}' –