0

I want to implement a UI which will have button at the beginning and end of text like below.

enter image description here

Is this possible? As long as text buttons fit on screen I understand we can arrange the controls as button-label-button, but in this case label text alignment will be after the first button. Also if text is multiline and finishes in middle, ext button will be after label which will show white space in between.

Sagrian
  • 1,048
  • 2
  • 11
  • 29
  • 1
    Just guessing , You can use UITextview where you can add image to textview with TextAttachment and then you can get touch event on TextAttachment https://stackoverflow.com/a/19579603/4601900 and perform whatever action you want – Prashant Tukadiya Dec 28 '18 at 13:02
  • @PrashantTukadiya I explicitly need buttons because there are some images on it which needs to be updated based on selection - like a switch. It's not text. – Sagrian Dec 28 '18 at 13:16
  • Yes that I am telling you that you can use UItextView control and add UIImage to it instead of button and you can also add touch event to it – Prashant Tukadiya Dec 28 '18 at 13:18

1 Answers1

0

You should subclass UITextView, and then in the implementation of your class add UIButton instances to the origin and end of the frame.

See here for inspiration.

Woodstock
  • 22,184
  • 15
  • 80
  • 118