2012-02-17 8 views
1

問題を説明する抜粋です。電話機が横長の場合、ボタンの上隅は表示されません。どうして?これは私に起こっている問題の例です。UINavigationControllerのサイズが正しくないと位置が正しく表示されない

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    UIViewAutoresizing ar = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; 

    window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 
    [window makeKeyAndVisible]; 
    window.rootViewController = self; //The delegate is a controller 

    UIViewController* vc = [[UIViewController new] autorelease]; 

    nc = [[UINavigationController alloc] initWithRootViewController:vc]; 
    CGRect r = self.view.frame; 
    r.origin = CGPointZero; 
    nc.view.frame = r; 
    [self.view addSubview:nc.view]; 

    nc.view.autoresizingMask = ar; 

    UIView* b = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
    r.size = vc.view.frame.size; 
    b.frame = r; 
    b.autoresizingMask = ar; 
    [vc.view addSubview:b]; 
    return YES; 
} 

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
{ 
    return YES; 
} 

ありがとうございます。

答えて

0

私はあまりにもこの種の問題今日持っていた - 使用可能なすべての旗にあなたのサイズ変更マスクを設定してみてください:

UIViewAutoresizingFlexibleHeight | 
UIViewAutoresizingFlexibleWidth | 
UIViewAutoresizingFlexibleRightMargin | 
UIViewAutoresizingFlexibleBottomMargin | 
UIViewAutoresizingFlexibleTopMargin | 
UIViewAutoresizingFlexibleLeftMargin ; 
+0

を申し訳ありませんが、助けにはなりませんでした。 – Tiiba

関連する問題