The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > Developer > Omni Frameworks
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
iPad OUInspector, Slices, Color... Thread Tools Search this Thread Display Modes
I'm trying to wrap my head around the OUIInspector code and canít seem to get what I need going. Starting off simple I want to change the background color of a view.

When I init the Inspector I pass it a theView I want to Change. The View has the protocol defined in it and functions for it implemented.

When I call up the Inspector with the Color Slice I only see the DetailSlice Navigation swatch, which does nothing when I click it. I'm not 100% sure where the other colors are supposed to come from?

Also Looking at the isAppropriate functions, it seems like my view I pass in does not seem to be an appropriate object.

How does the Slice get its List of Initial Colors?

If I want to Change the Color of more than one Object and want them to each have their own ColorInspectorSlice how do I differentiate the two slices to act upon their respective objects?

Any Suggestions?

Thanks!
 
There are a couple options. The simplest is to have your object conform to OUIColorInspection, use one or more OUIColorInspectorSlices and set/get the appropriate color property for the passed in slice.

You could also subclass OUIAbstractColorInspectorSlice (BackgroundColorInspectorSlice, say) and implement -isAppropriateForInspectedObject: on it to allow your view to be inspected by it. You might require the object to be an instance of your class, or you might just require it to implement -backgroundColor and -setBackgroundColor:.

Additionally in your subclass, you'd implement the required subclass methods for OUIAbstractColorInspectorSlice, -getColorsFromObject:, -setColor:forObject:, and -loadColorSwatchesForObject:.

Using OUIColorInspectorSlice is probably the simplest, but it isn't the only way.
__________________
CTO, The Omni Group
 
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!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Integrating color across products (iPad colors better than OS X?) RobTrew OmniFocus 2 for Mac (Private Test) 6 2013-04-26 01:58 PM
Confused re sync of ipad with iphone and mac - ipad now master version sueiyoung OmniFocus for iPad 0 2012-09-01 12:10 PM
Task color doesn't match the group's color mr_projects OmniPlan General 1 2007-11-02 11:34 AM
pizza slices ronpar OmniGraffle General 4 2006-11-03 07:57 PM


All times are GMT -8. The time now is 12:15 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.