Semen Matusovskiy Well-Known Member Licensed User Apr 3, 2020 #1 I need to convert UIColor to CGColor (to set border color in a layer). At first, I used Objective-C. B4X: - (NSObject *) UIColorToCGColor: (UIColor *) u { return [u CGColor]; } Worked as expected (result was <CGColor 0x600002a3e1c0>...). But then I tried u.RunMethod ("CGColor", Null)). Result: <B4INativeObject: {length = 8, bytes = 0xc0e1a30200600000}>. As I understand, this is CGColorRef instead of CGColor. Why ? Attachments test.zip 1.1 KB · Views: 159 Last edited: Apr 3, 2020
I need to convert UIColor to CGColor (to set border color in a layer). At first, I used Objective-C. B4X: - (NSObject *) UIColorToCGColor: (UIColor *) u { return [u CGColor]; } Worked as expected (result was <CGColor 0x600002a3e1c0>...). But then I tried u.RunMethod ("CGColor", Null)). Result: <B4INativeObject: {length = 8, bytes = 0xc0e1a30200600000}>. As I understand, this is CGColorRef instead of CGColor. Why ?
Erel B4X founder Staff member Licensed User Longtime User Apr 5, 2020 #2 CGColor cannot be simply converted to NSObject* as it is a C struct. Upvote 0