I am having a problem! When I use addSubview: and add a view to a UIScrollView, it adds a completely new view.
I want to either:
- toggle between 3 predefined views, or
- remove the last view from the UIScrollView before adding another one.
(All 3 views have some images so I’d imagine that the second option would be more efficient, memory-wise. However, perhaps the first option would be better on battery life? This is a ‘subquestion’.)
How does one accomplish this?
You could accomplish your plan B by using
removeFromSuperviewfunction of yourUIView.Use it as below.
EDITED:
When you create
UIImageViewassign a tag value to each and also use and integer iVar to hold the tag value of your current view lets say it’s currentViewTag ;Now use as below