Which method determines the rotation of device from Portrait to Landscape mode
<p>I have this method but where should i put this method???</p>

<pre><code>[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver: self
  selector: @selector(receivedRotate:) name: UIDeviceOrientationDidChangeNotification
  object: nil];

// This method is called by NSNotificationCenter when the device is rotated.
-(void) receivedRotate: (NSNotification*) notification
{
    UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
    if(interfaceOrientation != UIDeviceOrientationUnknown)
        [self deviceInterfaceOrientationChanged:interfaceOrientation];
}
</code></pre>
