So, I'm trying to change the UILabel
on a UIButton
to an instance of an FXLabel
instead. Check out the link for more on FXLabel
(https://github.com/nicklockwood/FXLabel). I know by using class extensions (Subclass UIButton to add a property), I could always add another property, in my case, an FXLabel
by just adding a subview basically. However, I like the convenience and features of the titleLabel
property already present.
Is there some method to "switch" the UILabel
for an FXLabel
by subclass or category?
I do know I could do this, but it's such a hack and isn't future proof. And I don't know how to then change the class type (Get UILabel out of UIButton).
UILabel *label;
for (NSObject *view in button.subviews) {
if ([view isKindOfClass:[UILabel class]]) {
label = (UILabel *)view;
break;
}
}
Thoughts?? Thanks.