ios - 如何将自定义大小设置为以模态方式呈现 ViewController

标签 ios swift uistoryboardsegue

我有 ViewController,当用户点击它的底部时,其他 ViewController 使用 segue Present Modally 弹出。 是否可以为他们提供自定义尺寸?我尝试通过 Use Preferred Explicit Size 选项提供内容大小,但它没有帮助。我希望那个 VC 弹出并从 up 中获取当前 VC 的 70%。

最佳答案

看看这个,如果您需要任何说明,请告诉我。

__weak IBOutlet UIView *conViewers;

- (void)callingOfCustomView:(UIViewController *)showPushedVC
{

    [showPushedVC.view setTranslatesAutoresizingMaskIntoConstraints:YES];
    showPushedVC.view.frame = conViewers.bounds;
    //**>> Add child view into container view
    [conViewers addSubview: showPushedVC.view];
    [self addChildViewController: showPushedVC];
    [showPushedVC didMoveToParentViewController:self];
}

 UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];

    ViewersVC *objViewers = [storyboard instantiateViewControllerWithIdentifier:@"ViewersVC"];

    [self callingOfCustomView:objViewers];

会尽快更新。

关于ios - 如何将自定义大小设置为以模态方式呈现 ViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41377547/

相关文章:

objective-c - 如何关闭segue ios8

ios - 删除 TabGroup 选项卡标题并仅在适用于 iOS 的 Appcelerator 应用程序上显示图标

ios - 委托(delegate)方法未被调用或调用时未触发

ios - 在 iPhone 5s 上的 iOS 8 Swift 上使用 NSUserDefaults 后启动时出现 EXC_BREAKPOINT,而不是模拟器

ios - 如何让 shouldPerformSegueWithIdentifier 等到 block 完成

ios - 显示(推送)Segue 留下上一个 View 的印记

ios - IOS中手写转文本API

ios - 断开 Wi-Fi 网络时如何在后台获取 iOS 中的可达性通知?

ios - 识别核心数据属性类型

ios - 如何在 Swift 中访问存储在marker.userData中的Google map 标记数据