Categories for iOS classes with FMX? [duplicate]


This question already has an answer here:

What are good uses for class helpers?

8 answers

Is it possible to create categories to define custom additional methods for existing iOS classes and controls in Delphi/FMX (like in Xcode, without subclassing?

For example, i want to change the appearance of UILabel, especialy the text alignment of them, within a UIAlertContoller class. In Xcode I would simply create a neu category for UILabel with a new method:

@interface UILabel (TextAppearance) @property (nonatomic, assign) NSTextAlignment appearanceAlignment UI_APPEARANCE_SELECTOR;

@ implementation UILabel (TextAppearance)

-(void)setAppearanceAlignment(NSTextAlignment)alignment {
[self setTextAlignment:alignment]; }

-(NSTextAlignment)appearanceAlignment {
return self.textAlignment; }


How can I do the same with Delphi/FMX?

Comments are closed.