0

横向きモードでのiPhoneの回転について少し助けが必要ですナビゲーションバーが伸びていません

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    UIImage *navBarImage = [UIImage imageNamed:@"nav-bar.png"];
    [[UINavigationBar appearance] setBackgroundImage:navBarImage 
                                       forBarMetrics:UIBarMetricsDefault];

    UIImage *barButton = [[UIImage imageNamed:@"bar-button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)];
    [[UIBarButtonItem appearance] setBackgroundImage:barButton forState:UIControlStateNormal 
                                          barMetrics:UIBarMetricsDefault];

    UIImage *backButton = [[UIImage imageNamed:@"back-button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0,15,0,6)];
    [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButton forState:UIControlStateNormal 
                                                    barMetrics:UIBarMetricsDefault];

    return YES;
}
4

1 に答える 1

0

このメソッドにはこのコードを記述しません。まず、メソッドで Yes を返す必要があります -

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}

そして、使用する必要があります:

-(void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)orientation
{ if(orientation == UIInterfaceOrientationPortrait)
// here your code
}
于 2012-10-04T23:23:47.160 に答える