From 6c2f14bc180418cfad42582be6ef1cc6a5413368 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Fri, 4 Jun 2010 15:35:57 +0000 Subject: [Author: dmaclach] Turns on the undeclared-selector warning. This may cause builds to fail if they are using our configs. Also cleaned up some whitespace issues. R=thomasvl DELTA=94 (71 added, 22 deleted, 1 changed) --- iPhone/GTMUIView+SubtreeDescription.h | 6 ++++++ iPhone/GTMUIView+SubtreeDescription.m | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'iPhone') diff --git a/iPhone/GTMUIView+SubtreeDescription.h b/iPhone/GTMUIView+SubtreeDescription.h index 1e714ed..627298a 100644 --- a/iPhone/GTMUIView+SubtreeDescription.h +++ b/iPhone/GTMUIView+SubtreeDescription.h @@ -44,4 +44,10 @@ @end +@protocol GTMUIViewSubtreeDescription +// A UIView can implement this and it can add it's own custom description +// in gtm_subtreeDescriptionLine. +- (NSString *)myViewDescriptionLine; +@end + #endif // DEBUG diff --git a/iPhone/GTMUIView+SubtreeDescription.m b/iPhone/GTMUIView+SubtreeDescription.m index bae0e2f..519aed0 100644 --- a/iPhone/GTMUIView+SubtreeDescription.m +++ b/iPhone/GTMUIView+SubtreeDescription.m @@ -31,7 +31,6 @@ static void AppendLabelFloat(NSMutableString *s, NSString *label, float f) { } } - static NSMutableString *SublayerDescriptionLine(CALayer *layer) { NSMutableString *result = [NSMutableString string]; [result appendFormat:@"%@ %p {", [layer class], layer]; @@ -60,7 +59,7 @@ static NSMutableString *SublayerDescriptionAtLevel(CALayer *layer, int level) { [result appendString:SublayerDescriptionLine(layer)]; // |sublayers| is defined in the QuartzCore framework, which isn't guaranteed // to be linked to this program. (So we don't include the header.) - NSArray *layers = [layer performSelector:@selector(sublayers)]; + NSArray *layers = [layer performSelector:NSSelectorFromString(@"sublayers")]; for (CALayer *l in layers) { [result appendString:SublayerDescriptionAtLevel(l, level+1)]; } @@ -127,11 +126,12 @@ static NSMutableString *SublayerDescriptionAtLevel(CALayer *layer, int level) { // for debugging dump the layer hierarchy, frames and isHidden. - (NSString *)sublayersDescription { CALayer *layer = [self layer]; - if (![layer respondsToSelector:@selector(sublayers)]) { + SEL sublayers = NSSelectorFromString(@"sublayers"); + if (![layer respondsToSelector:sublayers]) { return @"*** Sorry: This app is not linked with the QuartzCore framework."; } NSMutableString *result = SublayerDescriptionLine(layer); - NSArray *layers = [layer performSelector:@selector(sublayers)]; + NSArray *layers = [layer performSelector:sublayers]; for (CALayer *l in layers) { [result appendString:SublayerDescriptionAtLevel(l, 1)]; } -- cgit v1.2.3