2

まず第一に、Apple は私たちがアプリを横向きに最適化することを本当に嫌っているように感じます。

アプリで 2 日間苦労した後、最終的に常に横向きモードでのみ表示するように説得しました。私は、presentModalViewController で提示した UIViewController がランドスケープにも表示されることを確信しました。ここまでは順調ですね...

私が UIModalPresentationFormSheet で提示する UIViewController の位置は、ずっと右下にあります (iPad が横向きの位置にあります)。本来のように中央に移動させることができません。これがなぜ、またはどのように機能し、どのように正しい位置に表示することができるのか、誰か考えがありますか?

編集: コードを追加しました。このコードは、ボタンが押されたときに UIViewController から呼び出されます。

- (void) buttonPushed
{
    pickerViewController = [[UIViewController alloc] init];
    [pickerViewController.view setBackgroundColor:[UIColor whiteColor]];


    _pickerCustomers = [[UIPickerView alloc] initWithFrame:CGRectMake(22,20,380,216)];
    _pickerCustomers.delegate = self;
    _pickerCustomers.dataSource = self;
    [_pickerCustomers setShowsSelectionIndicator:YES];
    [pickerViewController.view addSubview:_pickerCustomers];

    _btnPickerDone = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [_btnPickerDone setFrame: CGRectMake(300,250,98,45)];
    [_btnPickerDone setTitle:@"Select" forState:UIControlStateNormal];
    [pickerViewController.view addSubview:_btnPickerDone];

    pickerViewController.modalPresentationStyle = UIModalPresentationFormSheet;

    [self presentModalViewController:pickerViewController animated:YES];
}
4

1 に答える 1

0

レイアウト IB の小さな「オートポジション スプリング」で遊んでみましたか? おそらく、下と右に付いていると思いますが、それらのアタッチメントを取り外してください。

ここにリンクがあります: http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html

必要に応じてコードで実行することもできます。

于 2011-09-07T15:14:05.257 に答える