View Single Post
Thank you for your reply... Before I break the ColorInspector I tried this out on my newText Inspector. So far its working pretty well.

I've decided to add a key value to the inspectorSlice, then let the object let the inspector slice know if it responds to that key.

something like this:
Code:
- (id)initWithKey:(NSString *)newInspectorSliceKey;
Then I can call it like:
Code:
	[slices addObject:[[[IoUITextInspectorSlice alloc] initWithKey:@"SETitle"] autorelease]];
	[slices addObject:[[[IoUITextInspectorSlice alloc] initWithKey:@"SEDescription"] autorelease]];
Then as part of the protocol I have the inspectable object define:
Code:
- (BOOL)objectHasKeyForInspectorSlice:(IoUIInspectorSlice *)inspector {
	if ([[inspector inspectorSliceKey] isEqualToString: @"SETitle"]){
		return YES;
	} else if ([[inspector inspectorSliceKey] isEqualToString: @"SEDescription"]){
		return YES;
	}
	return NO;
}

getting the value for the inspector looks like: (I also have one for the Label)
Code:
- (NSString *)textForInspectorSlice:(IoUIInspectorSlice *)inspector {
	if ([[inspector inspectorSliceKey] isEqualToString: @"SETitle"]){
		return screenTitle;
	} else if ([[inspector inspectorSliceKey] isEqualToString: @"SEDescription"]){
		return screenDescription;
	}
	return nil;
}
setter looks like:
Code:
- (void)setTextValue:(NSString *)newTextValue  fromInspectorSlice:(IoUIInspectorSlice *)inspector{
	if ([[inspector inspectorSliceKey] isEqualToString: @"SETitle"]){
		[self setScreenTitle:newTextValue];
		[self createToolbarItems];
	}
	if ([[inspector inspectorSliceKey] isEqualToString: @"SEDescription"]){
		[self setScreenDescription:newTextValue];
	}	
}
Any Comments would be super!

Thanks!