How to set the device orientation in iphone?
<p>I am doing a project which supports both landscape mode and portrait mode,but now i am struck there is no orentation in my project.I set the </p>

<pre><code>- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations.
    //return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
    return YES;
}
</code></pre>

<p>but no use,when i press the command +Right-arrow for rotation to right  it rotates to left but view and controllers didnt change to that orentation.Then after some googling i get this code</p>

<pre><code>if (self.interfaceOrientation == UIInterfaceOrientationPortrait) {
    // do stuff
}
</code></pre>

<p>But the problem is i didn't know how to write code in //do stuff.Please help me to do this.
thanks in advance.
 EDIT:
i put this code ,it is working but whenthe simulator is again turns to portrait it wont be in the default mode.my code is </p>

<pre><code>-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    {
        if ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight))
        {
            NSLog(@"Csantos shouldAutorotateToInterfaceOrientation: left or right");
            //
            table.transform = CGAffineTransformIdentity;
            table.transform = CGAffineTransformMakeRotation(degreesToRadian(90));
            table.bounds = CGRectMake(0.0, 0.0, 320, 402);//[self.view setFrame:CGRectMake(0.0, 0.0, 768, 90)];
        }
        else
        {
            table.transform = CGAffineTransformIdentity;
            table.transform = CGAffineTransformMakeRotation(degreesToRadian(360));
            table.bounds = CGRectMake(0.0, 51, 320, 402);
        }
               return YES;
   }*/
</code></pre>
