Question: My code goes like this:

```
- (void)viewDidLoad
{
  [self setGridView];
}
-(void)setGridView
{
  CGRect frame; 
  frame .origin.x=0;
  frame.origin.y=20;
  frame.size.width=GRID_WEIGHT;
  frame.size.height=GRID_HEIGHT;
  GridView *ObjGridView=[[GridView alloc]initWithFrame:frame]; 

  [[NSBundle mainBundle ] loadNibNamed:@"GridView" owner:ObjGridView options:nil];
  [ObjGridView setGridViewFrame:frame];

  [self.view addSubview:ObjGridView.GridCellView];
  frame .origin.x+=GRID_WEIGHT;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
  return YES;
}

```

This code adds a subview to a view and sets the frame

My problem:
1-How do i refresh my view when Orientation(landscape or portrait) happens,
because i set the frame of subview in the lanscape mode and i wants to use the sane view in my portrait view also .(basically where do i call this -(void)setGridView delegate method)?

2-How do i know, my subview exceeding the bound of the view,so that i can handle the subview in my setGridView method ?

Answer: 
1.Below method will call automatically whenever your orientation changes. Do the necessary changes according to each orientation.

```
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

if (interfaceOrientation == UIInterfaceOrientationPortrait) {}

else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {} 

else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {} 

else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {}

return YES;

}

```

2.You should know the width and height of your views and set the frames accordingly. That is not a big deal.

Hope this is helpful.
I am learning the ins and outs of iOS Application development myself, so please forgive me for the brevity of my response.

I believe you may be able to find the answer to your issue within the section titled 'Responding to Orientation Changes' within this document on Apple's Developer Resources:

<http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html>

I hope this helps you deduce a resolution to your issue.