Created
June 9, 2015 23:25
Sample.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MixiSampleClass.m | |
// TrainingObjectiveC | |
// | |
// Created by masai on 2015/06/09. | |
// Copyright (c) 2015年 masai. All rights reserved. | |
// | |
#import "MixiSampleClass.h" | |
// クラス定数 const | |
static NSString* const constString = @"const"; | |
// クラス変数 static | |
static NSString* staticString = @"static"; | |
// 無名カテゴリ(privateなプロパティの拡張、無名クラス無いで宣言したpropertyやメソッドはprivate扱いになる) | |
@interface MixiSampleClass() | |
@property (nonatomic, assign) BOOL isEnabled; | |
@property (nonatomic, assign) SampleType sampleType; | |
@end | |
@implementation MixiSampleClass | |
// インスタンスメソッド - | |
-(id)initWithName:(NSString*) name sampleType:(SampleType) sampleType | |
{ | |
self = [super init]; | |
if(self){ | |
// access iVar, self.<var>や_<var>でアクセスが可能 | |
_name = name; | |
_isEnabled = YES; | |
_sampleType = sampleType; | |
} | |
return self; | |
} | |
// クラス・メソッド + | |
+(NSString*) getStaticString | |
{ | |
return staticString; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment