When I use addSubview method and then removeFromSubview to load next ViewController then after load view some times, my app crash. I have many images on views.
I think my memory isn’t released, in spite of I use ARC.
What I should use to make it work? I tried addChildViewController, but then my view aren’t loading.
As per memory management guidelines, whenever you say addSubview, the reference count increases by 1 and whenever you say removeFromSuperview the reference count decreases by one. So, if you are removing any view, that you have added to any view, the reference count should be adjusted and should not cause memory leak.
What problem I can foresee is that you are having memory leak in the added view (the view, that you are adding multiple times) and this in order overflowing your memory. Try maintaining the reference counts and it will work perfectly. As an alternate solution, you can also track memory leaks by using instrument tools.