简体   繁体   中英

UISlider - Add UILabel to min/max UIImageView?

As shown below, UISlider has a Minimum Image and Maximum Image.

These imageView elements can be set to any UIImage.

I have a custom UISlider scenario and I'm trying to simply make the left and right image a string ( UILabel ).

Any smart ideas about how I might inject a UILabel into these elements? Or failing that, how I can extend my UISlider subclass so that it has a UILabel either side of it?

I guess I could encapsulate inside another UIView but I don't love that idea.

Thanks

WS

UISlider布局

Here is smart & simple idea to achieve, that you want.

Look at this snapshot:

  • Do not set min and max image for UISlider.
  • Set UILabels on left and right of UISlider. UILabels allows to set string value.
  • You can create custom view or IBDesignable with slider & two labels. This would be very easier than subclass UISlider and overriding of default properties.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM