Skip to content
murakami edited this page Jul 3, 2012 · 8 revisions

Class

@interface ClassName :ItsSuperclass
{
    instance variable declarations
}
method declarations
@end

@implementation ClassName :ItsSuperclass
{
    instance variable declarations
}
method definitions
@end

init

- (id)init
{
    self = [super init];
    if (self) {
    }
    return self;
}

Protocol

形式プロトコル (formal protocol)

@protocol ProtocolName
method declarations
@end

プロトコルの継承

@protocol ProtocolName1 <ProtocolName2>
method declarations
@end

非形式プロトコル (informal protocol)

カテゴリ宣言

@interface ClassName ( CategoryName )
method declarations
@end

Category

#import "ClassName.h"
@interface ClassName ( CategoryName )
// メソッド宣言
@end