Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec mauris nibh, venenatis sed purus nec, consequat commodo turpis. Quisque rhoncus maximus mattis. Morbi convallis sagittis lectus eget mollis. Nunc tristique, lectus ac faucibus elementum, dui enim porta ex, nec vestibulum sem neque sit amet est. Donec massa arcu, fermentum a massa eu, maximus rutrum urna. Vestibulum imperdiet pulvinar ipsum, non imperdiet orci efficitur quis. Donec volutpat erat dui, a sodales enim blandit ut. Pellentesque ac imperdiet nibh, sed feugiat lorem. Praesent in velit et est tempus facilisis sed at urna. Nulla sapien sem, sagittis eu mauris quis, consequat tempor sem. Mauris rhoncus, turpis eu vehicula volutpat, nibh libero fermentum quam, vel posuere ante metus quis leo. Maecenas et lorem feugiat neque lobortis accumsan.
2
votes
3 Answers
2
votes
You should use the opaque type CGColorRef
instead of UIColor
on your struct. Then, in the CocoaTouch portion of your code you could get a UIColor
instance like this:
UIColor *color = [UIColor colorWithCGColor:colorRef];
0
votes
I saves you some hassle if you follow that advice of not mixing structs and objects. That leaves you with two possibilities:
- Using Objective-C objects: Make "LevelMeterColorThreshold" a class with two properties instead of a struct.
- Use C structs and C primitives: Instead of "UIColor" use three floats red/green/blue - if that is sufficient. Then you can reconstruct a UIColor later on.
I probably would pick #1.
0
votes
How is it possible that in this example: http://developer.apple.com/library/ios/#samplecode/SpeakHere/Listings/AudioViews_LevelMeter_h.html#//apple_ref/doc/uid/DTS40007802-AudioViews_LevelMeter_h-DontLinkElementID_7
they are using the struct with UIColor*?