我有这个代码:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if( UIInterfaceOrientationIsLandscape(toInterfaceOrientation) )
{
[[NSBundle mainBundle] loadNibNamed:@"ChatViewController-landscape" owner:self options:nil];
}else {
[[NSBundle mainBundle] loadNibNamed:@"ChatViewController" owner:self options:nil];
}
}
我在 if( UIInterfaceOrientationIsLandscape(toInterfaceOrientation) 行中设置了一个断点。但是第一次它没有进入那行代码。如果我转动手机,那个时间和随后的方法被调用。我怎样才能调用那个方法第一次?