Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在选项卡栏中调整webView的大小';更多';制表符SWIFT_Ios_Swift_Webview - Fatal编程技术网

Ios 在选项卡栏中调整webView的大小';更多';制表符SWIFT

Ios 在选项卡栏中调整webView的大小';更多';制表符SWIFT,ios,swift,webview,Ios,Swift,Webview,嗨,我是堆栈溢出新手,大约一周前我遇到了一个问题: 我的IOS应用程序基于UIWebView,它们位于选项卡栏的不同选项卡中,共有9个选项卡,显示的选项卡完全可以正常工作,但“更多”部分中的选项卡都出现了故障,在webView的顶部和底部都有一个黑色空间,我想知道如何使它的大小相应的空间,视图可以占用或如何简单地取出这个黑色空间 谢谢 萨查 更新:修复了顶部,但底部的一些像素仍然不是webView的一部分 您需要设置webView滚动视图的contentInset: webView.scrol

嗨,我是堆栈溢出新手,大约一周前我遇到了一个问题:

我的IOS应用程序基于
UIWebView
,它们位于选项卡栏的不同选项卡中,共有9个选项卡,显示的选项卡完全可以正常工作,但“更多”部分中的选项卡都出现了故障,在webView的顶部和底部都有一个黑色空间,我想知道如何使它的大小相应的空间,视图可以占用或如何简单地取出这个黑色空间

谢谢 萨查

更新:修复了顶部,但底部的一些像素仍然不是webView的一部分

您需要设置webView滚动视图的contentInset:

webView.scrollView.contentInset = UIEdgeInsetsZero
Deafult

webView.scrollView.contentInset=UIEdgeInsetsZero

完整示例:

以ViewController为例,但该思想适用于tabBar控制器(或带有tabBar的ViewController)

WebViewController.swift

主故事板


大宗报价


您需要设置webView滚动视图的contentInset:

webView.scrollView.contentInset = UIEdgeInsetsZero
Deafult

webView.scrollView.contentInset=UIEdgeInsetsZero

完整示例:

以ViewController为例,但该思想适用于tabBar控制器(或带有tabBar的ViewController)

WebViewController.swift

主故事板


大宗报价


感谢它解决了我的问题,我的代码与示例中的代码完全相同,我只是添加了一行ant it fixed 99%;)。现在我只是在屏幕的底部有一点白色。现在我需要知道如何修复这5个底部像素。我需要看到你的项目。你可以用这个样本创建一个样本项目,或者通过电子邮件发送它吗?当然可以。你的电子邮件是什么?明白了。我将尽可能快地帮助您。感谢您解决了我的问题,我的代码与示例中的代码完全相同,我刚刚添加了一行ant it fixed 99%;)。现在我只是在屏幕的底部有一点白色。现在我需要知道如何修复这5个底部像素。我需要看到你的项目。你可以用这个样本创建一个样本项目,或者通过电子邮件发送它吗?当然可以。你的电子邮件是什么?明白了。我会尽可能快地帮助你。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="fNb-w0-GoK">
<dependencies>
    <deployment identifier="iOS"/>
    <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
    <!--View Controller-->
    <scene sceneID="tne-QT-ifu">
        <objects>
            <viewController id="BYZ-38-t0r" sceneMemberID="viewController">
                <layoutGuides>
                    <viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
                    <viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
                </layoutGuides>
                <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                    <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                    <subviews>
                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qYE-Qt-Pdb">
                            <rect key="frame" x="277" y="285" width="46" height="30"/>
                            <state key="normal" title="Button"/>
                            <connections>
                                <segue destination="WGg-GA-JYj" kind="show" identifier="toWebViewController" id="X7W-oO-znq"/>
                            </connections>
                        </button>
                    </subviews>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
                    <constraints>
                        <constraint firstItem="qYE-Qt-Pdb" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Yp4-rg-uRU"/>
                        <constraint firstItem="qYE-Qt-Pdb" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="hCZ-Me-NTn"/>
                    </constraints>
                </view>
                <navigationItem key="navigationItem" id="ypr-4x-iVU"/>
            </viewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="1099" y="559"/>
    </scene>
    <!--Web View Controller-->
    <scene sceneID="OnG-Ir-ldX">
        <objects>
            <viewController id="WGg-GA-JYj" customClass="WebViewController" customModule="stackoverflow_39097959" customModuleProvider="target" sceneMemberID="viewController">
                <layoutGuides>
                    <viewControllerLayoutGuide type="top" id="aes-Hs-ALg"/>
                    <viewControllerLayoutGuide type="bottom" id="k9x-oU-rHI"/>
                </layoutGuides>
                <view key="view" contentMode="scaleToFill" id="cnA-Wg-EC0">
                    <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                    <subviews>
                        <webView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1wq-mG-bgW">
                            <rect key="frame" x="0.0" y="64" width="600" height="536"/>
                            <color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="deviceRGB"/>
                        </webView>
                    </subviews>
                    <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                    <constraints>
                        <constraint firstItem="1wq-mG-bgW" firstAttribute="leading" secondItem="cnA-Wg-EC0" secondAttribute="leading" id="6ba-OZ-vfB"/>
                        <constraint firstItem="1wq-mG-bgW" firstAttribute="top" secondItem="aes-Hs-ALg" secondAttribute="bottom" id="Krw-Xl-SDX"/>
                        <constraint firstAttribute="trailing" secondItem="1wq-mG-bgW" secondAttribute="trailing" id="qk7-A7-tXd"/>
                        <constraint firstItem="1wq-mG-bgW" firstAttribute="bottom" secondItem="k9x-oU-rHI" secondAttribute="top" id="scz-71-oN5"/>
                    </constraints>
                </view>
                <navigationItem key="navigationItem" id="1tS-GL-oIH"/>
                <connections>
                    <outlet property="webView" destination="1wq-mG-bgW" id="u7n-Tl-NII"/>
                </connections>
            </viewController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="0Rf-a9-fCM" userLabel="First Responder" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="1818" y="559"/>
    </scene>
    <!--Navigation Controller-->
    <scene sceneID="0Hz-no-KQO">
        <objects>
            <navigationController automaticallyAdjustsScrollViewInsets="NO" id="fNb-w0-GoK" sceneMemberID="viewController">
                <toolbarItems/>
                <navigationBar key="navigationBar" contentMode="scaleToFill" id="I39-SK-Dmu">
                    <rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
                    <autoresizingMask key="autoresizingMask"/>
                </navigationBar>
                <nil name="viewControllers"/>
                <connections>
                    <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Zkp-F4-EwR"/>
                </connections>
            </navigationController>
            <placeholder placeholderIdentifier="IBFirstResponder" id="ptJ-Hj-WO2" userLabel="First Responder" sceneMemberID="firstResponder"/>
        </objects>
        <point key="canvasLocation" x="378" y="559"/>
    </scene>
</scenes>
</document>