Gargolev
Gargolev

Reputation: 43

iOS. How to draw complex images on a UIButton?

I need to make something like this (rectangles mean various pictures):

enter image description here

I know that it is possible to do this by making one image from two and assigning it to a UIButton. But is there another way to do it by using insets?

Upvotes: 1

Views: 321

Answers (1)

Martin Ullrich
Martin Ullrich

Reputation: 100591

If you want the "button pressed" highlighted state for both images you could

  • Make it one image and one button
  • Make two buttons and assign images and implement a method (add to both buttons as target for UIControlEventAllEvents) that sets button1.highlighted & button2.highlighted = ((UIButton*)sender).highlighted

Upvotes: 1

Related Questions