これを使うにはプリプロセッサにDEBUGを追加する必要あり詳しくはこっち
// Debbugログ出力切り替え
#ifdef DEBUG
# define NSLog(...) NSLog(__VA_ARGS__)
#else
# define NSLog(...) {}
#endif
// Debbugログ出力切り替え
#ifdef DEBUG
# define NSLog(...) NSLog(__VA_ARGS__)
#else
# define NSLog(...) {}
#endif
//登録(didloadなどで)
[[NSNotificationCenter defaultCenter] addObserver:class
selector:@selector(yobimethod:) name:@"notificationName" object:nil];
/*class内*/
-(void)yobu{//呼び出し※引数はなくてもOK
NSDictionary *userInfo =
[NSDictionary dictionaryWithObject:obj forKey:@"objkey"];
[[NSNotificationCenter defaultCenter] postNotificationName:
@"notificationName" object:nil userInfo:userInfo];
}
//呼び出されるメソッド
-(void)yobimethod:(NSNotification *)notification{
NSString*key = [[notification userInfo] objectForKey:@"objkey"];
}
#import <QuartzCore/QuartzCore.h>//使用クラスにインポートの必要あり
-(void)createKadomaru{
UIView * maru = [[[UIView alloc] initWithFrame:CGRectMake(0,0,100,100)] autorelease];
maru.center = self.view.center;
maru.backgroundColor = [UIColor whiteColor];
maru.layer.cornerRadius = 4.0;//角の丸み 値が大きいほど丸い
maru.clipsToBounds = YES;
[self.view addSubview:maru];
}
←完成はこんな感じ。#ifdef DEBUG NSLog(@"debugはこっちを通る"); #else NSLog(@"release,distributionはこっちを通る"); #endif