When adding subviews to a UIView, what's the difference between the methods addView: and insertView:atIndex:?
views:
299answers:
2
                +1 
                A: 
                
                
              
            AddView adds a view to an array of views.
InsertView adds a view into a specific position in an array.
Other than that, check the Documentation.
                  Jordan
                   2010-01-19 03:00:12
                
              
                +4 
                A: 
                
                
              
            Both add a view to the receiver as a subview, which causes the view to be displayed if the receiver is displayed and positioned relative to the receiver.
But,
- addSubview:adds your view to the end of the subview list, which places it on top of the other subviews when drawing.
- insertSubview:atIndex:adds your view at a particular position in the list, which places it above the subviews that come before it in the list, and below the subviews that come afterward.
[parentView addSubview:childView] is the same as [parentView insertSubview:childView atIndex:[[parentView subviews] count]].
Everything you need to know is here.
                  Kevin Conner
                   2010-01-19 03:05:21