Reputation: 151196
For example, can Objective-C call a C function, which calls Objective-C?
(UIColor *) getUIColorWithRGB(int r, int g, int b) {
return [UIColor colorWithRed: r / 255.0 green: g / 255.0 blue: b / 255.0 alpha: 1];
}
@implementation UIColorCollection
+(UIColor *) lightCyanColor {
return getUIColorWithRGB(224, 255, 255);
}
Upvotes: 0
Views: 175
Reputation: 56829
If talking about possibility, it is possible. Just remove the brackets in the return value of the C function:
UIColor * getUIColorWithRGB(int r, int g, int b) {
return [UIColor colorWithRed: r / 255.0 green: g / 255.0 blue: b / 255.0 alpha: 1];
}
Not sure whether this is OK as a programming practice, though.
Upvotes: 1