Objective C Category & Two Classes
-
05-06-2021 - |
Question
I have 2 classes:
XCALayer
derived fromCALayer
XCATextLayer
derived fromCATextLayer
I've created XCALayer+FrameMucking.h
category that allows me easily adjust XCALayer
's frame. The thing is that I would like to use it also for XCATextLayer
, but without duplicating all the code. Is it possible to use my category for both XCALayer
and XCATextLayer
?
Solution
If you are just changing the frame of XCALayer
and XCATextLayer
you should be able to add a category to CALayer
since frame
is a property of CALayer
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow