IPhone & UISegmentedControl - Change images and save title?

Can I somehow change the images for all segments in a managed control and keep the title?

Does this remove the name when adjusting the image? or does it display a UImageView on top of the label? If the image goes over the mark, is it possible to access it and send it back ???

+3
source share
3 answers

I ended the loop of each UISegment in my UISegmentedControl. I added a UIImageView for each UISegment and sent them back to the view

+1
source

I do not think that's possible. The documentation states the following:

title ( NSString) ( UIImage).

, .

+1

Try it.

UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:nil];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"up_button.png"] atIndex:0 animated:YES];
[segmentedControl insertSegmentWithImage:[UIImage imageNamed:@"down_button.png"] atIndex:1 animated:YES];
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
[segmentedControl setMomentary:YES];
+1
source

Source: https://habr.com/ru/post/1779233/


All Articles