because if you use -(void)viewDidLayoutSubviews it will work definitely but this method is called every time your UI demands updations/changes. Which will get hard to manage. Soft key is you use a bool variable to avoid such loop of calls. better use viewWillAppear. Remember viewWillAppear will also be called if view is loaded back again (without reallocating).