All pastes #924279 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-01 05:28 UTC
rendered paste body
CGColorRef *color(NSString *color) {
	float color[4];
	if([ color isEqualToString: @"blue" ])
		color = {0.0f, 0.0f, 1.0f, 1.0f};
	if([ color isEqualToString: @"green" ])
		color = {0.0f, 1.0f, 0.0f, 1.0f};
	if([ color isEqualToString: @"red" ])
		color = {1.0f, 0.0f, 0.0f, 1.0f};
	return CGColorCreate(CGColorSpaceCreateDeviceRGB(), color);
}


@implementation myObject

- (void)initWithFrame(CGRect)rect {
	UITextLabel myLabel* = [ [ UITextLabel alloc ] initWithFrame: rect ];
	[ myLabel setColor: color(@"blue") ];
}

@end

macdog: quick example of a c function. Hope it helps, its untested so I am not sure if it works.

-MxWeas