导航控制器视图大小适合[swift]

时间:2016-12-21 03:53:13

标签: swift uinavigationcontroller

我有这组代码:

    MOLPay = MOLPayLib(delegate: self, andPaymentDetails: paymentRequestDict)

    let navigationController = UINavigationController(rootViewController: MOLPay)

    let btn: UIButton = UIButton(frame: CGRectMake(0, 0, 35, 35))
    btn.setImage(UIImage(named: "scan_ic_back.png"), forState: UIControlState.Normal)
    btn.addTarget(self, action: #selector(MolPayNowViewController.closeMolPay(_:)), forControlEvents: UIControlEvents.TouchUpInside)

    let barButton = UIBarButtonItem(customView: btn)

    MOLPay.navigationItem.leftBarButtonItem = barButton

    MOLPay.navigationController?.navigationBar.barTintColor = UIColor(hexString: "#76DD4A")

    self.presentViewController(navigationController, animated: true, completion: nil)

它变得像这样,我想显示适合屏幕大小的页面大小,但是如何做到这一点?自从它的嵌入式导航控制器。有人可以帮忙。

enter image description here

我想要的是:

enter image description here

1 个答案:

答案 0 :(得分:0)

您的问题是UIWebView没有调整其内容的大小以使其适合手机的屏幕。我是对的吗?

要使整个网络视图的内容适合屏幕,请在视图控制器中执行此操作:

yourWebView.scalesPageToFit = true