uiview - What is the use of removeFromSuperView in iphone? -
in program, if put below line in cellforrowatindexpath(tableview), scrolling fine. otherwise, lines crashed. want know code did?
the code is....
for (uiview *oldviews in cell.contentview.subviews) { [oldviews removefromsuperview]; }
thanks in advance
you have know in ios manipulating "views". views ui parts (images, labels, inputs etc.) or containing layer.
at launch beginning must add view window. can add add many views want on view.
if add view b on view a. , view on window.
semantic :
- view superview of b
- view b subview of a
- view subview of window
the window superview of view a
so if invoke removefromsuperview on b, removing b on (and displaying).
please note :
when add subview (addsubview:) retain performed on view added.
when remove view (removefromsuperview: or removesubviewatindex:) release performed on view removed.
to answer initial question
for (uiview *oldviews in cell.contentview.subviews) { [oldviews removefromsuperview]; }
perform removefromsuperview method on every cell.contentview subviews. old views removed screen not necessary deallocated (they released retaincount - 1).
Comments
Post a Comment