Return statement in "shouldAutorotate...." method


#1

can someone pls explain what the following expression actually does. (refer page.435)

return io = UIInterfaceOrientationPortrait;

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)io
{
if([[UIDevice currentDevice] userInterfaceIdiom] == UiUserInterfaceIdiomPad)
return YES;

return io = UIInterfaceOrientationPortrait;
}

thanks
Sachin


#2

It should be ==, not just =.

This method says if you are on the iPad, always return YES. if you are not, return YES only if UIInterfaceOrientationPortrait is equal to io.