In my view i added 4 UIButtons at bottom (something like tab bar application) and when I click on any button I added their respective subviews through add subview method , and when user click on another button a new subview is added on that view and so on. I am sure this is not a right way to do this task. so kindly suggest the way i could handle this situation while taking memory management into consideration.
Asked
Active
Viewed 484 times
2
-
Why not using UITabbarController? – Samet DEDE Jul 25 '13 at 08:26
2 Answers
0
This can be done in two ways :
- Add subview and then remove old subview when click on other button
- Add all subview first time and then show and hide them.
This is the proper way for memory management.

Nishant Tyagi
- 9,893
- 3
- 40
- 61
-
Can you please give any sample code of doing it through first approach,i can't follow second approach as my view are not static. – Vikas Jul 25 '13 at 07:31
0
You can use UIViewController Containment
,
The best thing I have found so far is the WWDC 2011 Session Video
Session 102 - Implementing UIViewController Containment.

Community
- 1
- 1

Toseef Khilji
- 17,192
- 12
- 80
- 121