【问题标题】:ios7 presentviewcontroller cannot set frameios7 presentviewcontroller 无法设置框架
【发布时间】:2014-05-07 08:39:17
【问题描述】:

我在 iOS 6 中使用过这段代码,我可以在主视图中间显示另一个视图。但是,当我在 iOS 7 中运行时,呈现的视图的原点始终为 0,0。我该怎么办?

rect= CGRectMake((self.view.bounds.size.width/2)-300,(self.view.bounds.size.height/2)-200,600,400);
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:sVCiPad animated:YES completion:nil];
[sVCiPad.view setFrame:rect];

【问题讨论】:

    标签: ios uiview uiviewcontroller presentviewcontroller


    【解决方案1】:

    modalPresentationStyle 更改为UIModalPresentationFormSheet

    代替

    self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
    

    试试这个

    sVCiPad.modalPresentationStyle = UIModalPresentationFormSheet;
    

    【讨论】:

    • 谢谢。现在好了。
    • 但我无法设置框架。我该怎么办?此代码在 iOS 7 中不起作用。 sVCiPad.view.superview.bounds = CGRectMake(0, 0, 400, 500);
    • 我找到了解决方案。 stackoverflow.com/questions/2457947/…
    猜你喜欢
    • 2012-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多