I set frame for all UI elements in `ViewDidload` and changing their frames in 

```
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator

```

The problem is when I try to Navigate from `View A --> View B` in portrait and then change orientation landscape comeback to View A <-- View B. Then frames are not chaning accordingly. 

I tried adding 

```
[self.view setNeedsLayout];
[self.view layoutIfNeeded];

```

But still frames are not changing even viewWillTransitionToSize is not getting called when it comebacks.

```
   - (void)viewDidLoad {
        [super viewDidLoad];

        scrollView = [UIScrollView new];
        scrollView.frame = CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height-hSelecViewHeight);
        scrollView.backgroundColor = [UIColor whiteColor];
        scrollView.bounces = true;
        scrollView.alwaysBounceVertical = true;
        [self.view addSubview:scrollView];

         imagePager = [[KIImagePager alloc]init];
            imagePager.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width*0.563);
            imagePager.delegate = self;
            imagePager.dataSource = self;
            imagePager.slideshowTimeInterval = 2.0;
            [imagePager setImageCounterDisabled:true];
            [scrollView addSubview:imagePager];

    -- and few other UI elements also --
    }

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        self.navigationController.navigationBar.barTintColor = barColor;

        [self.view setNeedsLayout];
        [self.view layoutIfNeeded];

            hSelView.frame = CGRectMake(0,self.view.frame.size.height-hSelecViewHeight,self.view.frame.size.width,hSelecViewHeight);
            scrollView.frame = CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height-hSelecViewHeight);
            imagePager.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width*0.563);
            [hSelView reloadData];
            if (categoryIndex!=0){
                tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, (259*[[arrListData valueForKey:@"sub_category_name"] count])+100);
                [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, ([[arrListData valueForKey:@"sub_category_name"] count]*259)+100)];

            }else{
                tableView.frame = CGRectMake(0, imagePager.frame.origin.y+imagePager.frame.size.height+1, self.view.frame.size.width, (259*[[arrList valueForKey:@"name"]count])+100);
                [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, ([[arrList valueForKey:@"name"]count]*259)+(self.view.frame.size.width*0.563-40)+100)];

            }

    }
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
     {
         UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
         NSLog(@"orientation:- %ld",(long)orientation);

         if (!isMaximized) {
             content.view.frame = CGRectMake(self.view.frame.size.width-(self.view.frame.size.width/1.5)-10, self.view.frame.size.height-hSelecViewHeight-10-((self.view.frame.size.width/1.5)*0.563), self.view.frame.size.width/1.5, (self.view.frame.size.width/1.5)*0.563);
             closePopButton.frame = CGRectMake(content.view.frame.size.width-40, 5, 36, 36);
             hSelView.frame = CGRectMake(0,self.view.frame.size.height-hSelecViewHeight,self.view.frame.size.width,hSelecViewHeight);
             scrollView.frame = CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height-hSelecViewHeight);
             imagePager.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width*0.563);
             [hSelView reloadData];
             if (categoryIndex!=0){
                 tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, (259*[[arrListData valueForKey:@"sub_category_name"] count])+100);
                 [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, ([[arrListData valueForKey:@"sub_category_name"] count]*259)+100)];

             }else{
                 tableView.frame = CGRectMake(0, imagePager.frame.origin.y+imagePager.frame.size.height+1, self.view.frame.size.width, (259*[[arrList valueForKey:@"name"]count])+100);
                 [scrollView setContentSize:CGSizeMake(self.view.frame.size.width, ([[arrList valueForKey:@"name"]count]*259)+(self.view.frame.size.width*0.563-40)+100)];

             }

         }

     } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
     {

     }];

    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}

```