I have an element that needs to behave like UIButton but it has several (3) text labels visible at once and multiple UIImages in the same bounding box. It's really a view with a bunch of different other UIViews and labels that needs to look and act like a button but with more custom placement of these elements than the standard UIButton.
Is it better to inherit from UIButton to accomplish this or is UIControl the one to inherit from?
When the element is tapped, I do want to mimic all of the highlighting effects (if it's UILabel, show the highlight text color, etc) as well.
As long as it doesn't matter which part of your button content gets tapped to activate it's functions you could compose a UIButton along with all the UILabel, UIImageViews you need.
You could easily inherit from UIView, place all of the above inside and place your transparent UIButton on top of everything to get the events you need (setting yourself as the target for that button and implementing some delegate to notify about selection).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With