I am using AddChildViewController and adding a CalendarViewController, here is the code to add it
- (void)calButtonClicked
{
m_calViewController = [[CalendarViewController alloc]initWithNibName:@"CalendarViewController" bundle:nil];
[self addChildViewController:m_calViewController];
[[self view] addSubview:[m_calViewController view]];
[m_calViewController didMoveToParentViewController:self];
}
Now this CalendarViewController I have a function to create the calendarUI , I have written it in
- (void)viewDidLoad
{
[self createCalendarUI];
}
Now whenever I click on the button to open this ViewController , method viewDidLoad is called everytime and it takes time to create the UI. And because of that , my app is becoming slow.
So is their any way so that my UI is created only once, So that I can improve the efficiency
Regards Ranjit.
if you just want to reuse CalendarViewController
try reuse CalendarViewController's view and do not alloc
CalendarViewController
incalButtonClicked
each time.