Iphone UIView显示错误的方向

Iphone UIView显示错误的方向,iphone,uiview,uiviewcontroller,Iphone,Uiview,Uiviewcontroller,在模拟器上一切正常,但在真正的iphone3g上存在bug。 我给闪屏打了两次电话。第一次-好的,第二次我看到错误: 我怎样才能修好它 @interface iStateGameAppDelegate : NSObject { UIWindow* window; UINavigationController* navigationController; } -(void) showSpalshScreen; -(void) showSwitchViewControll

在模拟器上一切正常,但在真正的iphone3g上存在bug。 我给闪屏打了两次电话。第一次-好的,第二次我看到错误:

我怎样才能修好它

@interface iStateGameAppDelegate : NSObject { UIWindow* window; UINavigationController* navigationController; } -(void) showSpalshScreen; -(void) showSwitchViewController; @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @end @implementation iStateGameAppDelegate @synthesize window; @synthesize navigationController; - (BOOL) application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) launchOptions { [self showSpalshScreen]; [window makeKeyAndVisible]; return YES; } -(void) showSpalshScreen { SplashScreen* splashScreen = [[[SplashScreen alloc] initWithNibName:@"SplashScreen" bundle:[NSBundle mainBundle]] autorelease]; [window addSubview:[splashScreen view]]; } -(void) showSwitchViewController { SplashScreen* splashScreen = [[[SplashScreen alloc] initWithNibName:@"SplashScreen" bundle:[NSBundle mainBundle]] autorelease]; [window addSubview:[splashScreen view]]; } - (void) dealloc { [navigationController release]; [window release]; [super dealloc]; } @interface SplashScreen : UIViewController {} @end @implementation SplashScreen // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { [super viewDidLoad]; NSTimer *timer = [[NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO] retain]; [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight); } - (void)timerFired:(NSTimer *)timer { [[UIApplication sharedApplication] setStatusBarHidden:FALSE]; iStateGameAppDelegate* app = [UIApplication sharedApplication].delegate; [app showSwitchViewController]; [[self view] removeFromSuperview]; [timer invalidate]; [timer release]; timer = nil; } - (void)dealloc { [super dealloc]; } @接口iStateGameAppDelegate:NSObject { UIWindow*窗口; UINavigationController*导航控制器; } -(无效)显示屏幕; -(无效)showSwitchViewController; @属性(非原子,保留)IBUIWindow*window; @属性(非原子,保留)IBuinavigationController*导航控制器; @结束 @实现iStateGameAppDelegate @合成窗口; @综合导航控制器; -(BOOL)应用程序:(UIApplication*)应用程序使用选项完成启动:(NSDictionary*)启动选项 { [自显示屏幕]; [WindowMakeKeyandVisible]; 返回YES; } -(无效)显示屏幕 { SplashScreen*SplashScreen=[[SplashScreen alloc]initWithNibName:@“SplashScreen”包:[NSBundle mainBundle]]自动释放]; [窗口添加子视图:[屏幕视图]]; } -(无效)showSwitchViewController { SplashScreen*SplashScreen=[[SplashScreen alloc]initWithNibName:@“SplashScreen”包:[NSBundle mainBundle]]自动释放]; [窗口添加子视图:[屏幕视图]]; } -(无效)解除锁定 { [导航控制器释放]; [窗口释放]; [super dealoc]; } @界面飞溅屏幕:UIViewController{} @结束 @SplashScreen的实现 //实现viewDidLoad以在加载视图(通常从nib)后执行附加设置。 -(无效)viewDidLoad { [超级视图下载]; NSTimer*timer=[[NSTimer timerWithTimeInterval:1.0目标:自选择器:@selector(timerFired:)用户信息:无重复:无]保留]; [[NSRunLoop currentlunloop]addTimer:timer forMode:NSDefaultRunLoopMode]; } -(布尔)应将自动旋转指针面方向:(UIInterfaceOrientation)转换为接口方向 { 返回(toInterfaceOrientation==UIInterfaceOrientationAndscapeRight); } -(void)timerFired:(NSTimer*)计时器 { [[UIApplication sharedApplication]setStatusBarHidden:FALSE]; IStateAmpAppDelegate*应用程序=[UIApplication sharedApplication]。委托; [应用程序showSwitchViewController]; [[self view]从SuperView中移除]; [计时器失效]; [计时器释放]; 定时器=零; } -(无效)解除锁定{ [super dealoc]; }
  • 确保视图的委托设置正确
  • 您可能应该同时检查
    ui接口方向和scaperight
    ui接口方向和scapeleft