开发者

iPad presentModalViewController appears in wrong position

First of, I get the feeling apple really doesnt like us optimizing apps for landscape view.

After struggling with my app for 2 days I finally convince it to always and only show in Landscape mode. I even convinced the UIViewController that I present with presentModalViewController to appear in landscape as well. So far so good...

The position of the UIViewController that I present with UIModalPresentationFormSheet is all the way to the bottom right (with the ipad in Landscape positition). I cannot get it to move to the center like it should. Does anyone have any ideas why and or how this works and how I can make it apear in the right position?

EDIT: Added code, this code is called from a UIViewController when a button is pushed.

- (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 = [开发者_JS百科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];
}


Have you tried playing with the little "autoposition springs" on the layout IB? Probably you have it attached to the bottom and right, simply remove those attachments.

Here's a link for you: http://disanji.net/iOS_Doc/#documentation/DeveloperTools/Conceptual/IB_UserGuide/Layout/Layout.html

Can also be done in code if you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜