これを使うにはプリプロセッサに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
NSArray * array=[NSArray arrayWithObjects: @"a",@"b",@"c",@"d",@"e",nil]; for(NSString*obj in [array reverseObjectEnumerator]){ NSLog(@"word=%@",obj); }eから順にaまで出力されます。よしよし。
BOOL stringflg = [obj isKindOfClass:[NSString class]];
//全再描画 [drawView setNeedsDisplay]; //一部再描画なら [drawView setNeedsDisplayInRect:CGRectmake(0,0,100,100)];をする。注意したいのはdrawViewが元々透明でなければ
drawView.opaque=YESdrawRectで描いたものはUIViewの背景色みたいな扱いだから