I would like to create a UIView which would show a colored circle with a number or character in it. I have seen examples to create a circle, but how would I accomplish this?
I would want to place multiple of these views on the screen and connect them with lines.
Any suggestions?
If you already know how to draw a circle, then you’ve got half of it solved 🙂 Let’s say the circle is drawn in a
UIViewcalledcircleView.Now you want to create a
UILabelto draw the letter in.And now you want to put the label on top of the
circleView, so you add it as a subview:At this point, depending on the size of
circleViewand the font size ofcircleLabel, the label may or may not be in the center of the circle. Use thesetFramefunction on thecircleLabelto adjust its position within thecircleView.