Difference between addSubview and insertSubview in UIView class
The only difference is in where the view is added: whether it is the frontmost view (addSubview:
), or it is before the 5th subview, (insertSubview:atIndex:
) or if it is immediately behind another subview (insertSubview:aboveSubview:
).
Using insertSubView:
you can specify the index, which determines z-order of views. A view with a higher index lies above those with lower indices.