不被frame包住

if(parent!=window){
top.location=window.location;
}
这是<?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina5_5" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Nn3-QC-nxS" customClass="CoverImageContainerView" customModule="SurveillanceHome" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="104" height="60"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Ymb-1Z-rVy"> <rect key="frame" x="0.0" y="0.0" width="104" height="60"/> </imageView> <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jtI-wO-mdh"> <rect key="frame" x="0.0" y="0.0" width="104" height="60"/> </imageView> <label opaque="NO" userInteractionEnabled="NO" tag="4" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="无设备" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HAB-vc-e6i"> <rect key="frame" x="0.0" y="21.666666666666668" width="104" height="17.000000000000004"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <nil key="highlightedColor"/> </label> </subviews> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <constraints> <constraint firstAttribute="bottom" secondItem="Ymb-1Z-rVy" secondAttribute="bottom" id="9hp-LI-0Pq"/> <constraint firstAttribute="trailing" secondItem="jtI-wO-mdh" secondAttribute="trailing" id="B7F-xq-aNc"/> <constraint firstItem="Ymb-1Z-rVy" firstAttribute="leading" secondItem="Nn3-QC-nxS" secondAttribute="leading" id="JZ8-VN-PsG"/> <constraint firstItem="Ymb-1Z-rVy" firstAttribute="top" secondItem="Nn3-QC-nxS" secondAttribute="top" id="MLz-rd-VQv"/> <constraint firstItem="HAB-vc-e6i" firstAttribute="leading" secondItem="Nn3-QC-nxS" secondAttribute="leading" id="NHo-HJ-TQD"/> <constraint firstItem="jtI-wO-mdh" firstAttribute="top" secondItem="Nn3-QC-nxS" secondAttribute="top" id="SWw-8H-i6T"/> <constraint firstItem="jtI-wO-mdh" firstAttribute="leading" secondItem="Nn3-QC-nxS" secondAttribute="leading" id="SXi-3Q-WT3"/> <constraint firstAttribute="trailing" secondItem="Ymb-1Z-rVy" secondAttribute="trailing" id="TpB-fX-Jep"/> <constraint firstItem="HAB-vc-e6i" firstAttribute="centerY" secondItem="jtI-wO-mdh" secondAttribute="centerY" id="bUY-Ze-acZ"/> <constraint firstAttribute="trailing" secondItem="HAB-vc-e6i" secondAttribute="trailing" id="bZ7-xU-i31"/> <constraint firstAttribute="bottom" secondItem="jtI-wO-mdh" secondAttribute="bottom" id="iQw-Zg-npu"/> </constraints> <nil key="simulatedTopBarMetrics"/> <nil key="simulatedBottomBarMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> <integer key="value" value="2"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> <connections> <outlet property="coverImageView" destination="Ymb-1Z-rVy" id="3Hy-Ol-y9S"/> <outlet property="coverLeadingConst" destination="JZ8-VN-PsG" id="kDU-49-Bef"/> <outlet property="coverTrailConst" destination="TpB-fX-Jep" id="sLz-so-upY"/> <outlet property="maskImageView" destination="jtI-wO-mdh" id="D93-E1-USj"/> <outlet property="maskLabel" destination="HAB-vc-e6i" id="AXY-sc-oTM"/> </connections> <point key="canvasLocation" x="-362" y="183"/> </view> </objects> </document> 还有big的<?xml version="1.0" encoding="UTF-8"?> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina6_1" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <view clipsSubviews="YES" contentMode="scaleToFill" id="cT9-nk-Xp8" customClass="CoverImageBigContainerView" customModule="OmadaSurveillance" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="320" height="180"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xz8-fG-Fzh"> <rect key="frame" x="0.0" y="0.0" width="320" height="180"/> </imageView> <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="3" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="NKG-S3-3dE"> <rect key="frame" x="0.0" y="0.0" width="320" height="180"/> </imageView> <label opaque="NO" userInteractionEnabled="NO" tag="4" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="无设备" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IPj-jj-q27"> <rect key="frame" x="16" y="58" width="288" height="20"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="14"/> <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Nje-Cx-Goc"> <rect key="frame" x="126" y="95.5" width="68" height="29"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/> <state key="normal"> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </state> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> <integer key="value" value="14"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </button> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="查看帮助" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M48-Ji-2wd"> <rect key="frame" x="136" y="95.5" width="48" height="29"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="12"/> <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <nil key="highlightedColor"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="string" keyPath="localizedKey" value="deviceListOfflineNeedHelp"/> </userDefinedRuntimeAttributes> </label> <view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="E37-JZ-yKU"> <rect key="frame" x="0.0" y="156" width="320" height="24"/> <subviews> <view userInteractionEnabled="NO" contentMode="center" translatesAutoresizingMaskIntoConstraints="NO" id="47L-L9-0LA" customClass="GradientView" customModule="OmadaSurveillance" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="320" height="24"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="color" keyPath="startColor"> <color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="color" keyPath="endColor"> <color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="number" keyPath="startLocation"> <real key="value" value="0.0"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="number" keyPath="endLocation"> <real key="value" value="1"/> </userDefinedRuntimeAttribute> <userDefinedRuntimeAttribute type="boolean" keyPath="horizontalMode" value="NO"/> </userDefinedRuntimeAttributes> </view> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="leW-L6-18B"> <rect key="frame" x="10" y="5" width="304" height="18"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <nil key="highlightedColor"/> </label> </subviews> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <constraints> <constraint firstItem="47L-L9-0LA" firstAttribute="height" secondItem="E37-JZ-yKU" secondAttribute="height" id="6Ny-zy-PcH"/> <constraint firstItem="47L-L9-0LA" firstAttribute="width" secondItem="E37-JZ-yKU" secondAttribute="width" id="K1Y-Xp-eE2"/> <constraint firstItem="leW-L6-18B" firstAttribute="centerY" secondItem="47L-L9-0LA" secondAttribute="centerY" constant="2" id="L0h-bw-mgz"/> <constraint firstAttribute="trailing" secondItem="leW-L6-18B" secondAttribute="trailing" constant="6" id="N9c-a8-JQn"/> <constraint firstItem="47L-L9-0LA" firstAttribute="centerX" secondItem="E37-JZ-yKU" secondAttribute="centerX" id="b8h-2m-cGW"/> <constraint firstItem="47L-L9-0LA" firstAttribute="centerY" secondItem="E37-JZ-yKU" secondAttribute="centerY" id="dVg-dL-ZJk"/> <constraint firstAttribute="height" constant="24" id="dzw-JL-iJb"/> <constraint firstItem="leW-L6-18B" firstAttribute="leading" secondItem="E37-JZ-yKU" secondAttribute="leading" constant="10" id="u2h-nX-4om"/> </constraints> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> <integer key="value" value="2"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> </view> </subviews> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <constraints> <constraint firstItem="xz8-fG-Fzh" firstAttribute="top" secondItem="cT9-nk-Xp8" secondAttribute="top" id="1Wm-wR-qFi"/> <constraint firstItem="Nje-Cx-Goc" firstAttribute="top" secondItem="M48-Ji-2wd" secondAttribute="top" id="4kL-sl-stz"/> <constraint firstAttribute="trailing" secondItem="E37-JZ-yKU" secondAttribute="trailing" id="BdB-Vr-tNg"/> <constraint firstAttribute="bottom" secondItem="E37-JZ-yKU" secondAttribute="bottom" id="CFt-QM-g3k"/> <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="M48-Ji-2wd" secondAttribute="trailing" constant="20" id="E26-0A-g7b"/> <constraint firstItem="Nje-Cx-Goc" firstAttribute="trailing" secondItem="M48-Ji-2wd" secondAttribute="trailing" constant="10" id="EGS-5w-RyC"/> <constraint firstAttribute="trailing" secondItem="NKG-S3-3dE" secondAttribute="trailing" id="GWn-JE-onB"/> <constraint firstItem="M48-Ji-2wd" firstAttribute="centerX" secondItem="cT9-nk-Xp8" secondAttribute="centerX" id="Lfo-n0-nYI"/> <constraint firstItem="Nje-Cx-Goc" firstAttribute="leading" secondItem="M48-Ji-2wd" secondAttribute="leading" constant="-10" id="Mt1-JD-EeK"/> <constraint firstItem="E37-JZ-yKU" firstAttribute="leading" secondItem="cT9-nk-Xp8" secondAttribute="leading" id="PJQ-t8-1KJ"/> <constraint firstItem="xz8-fG-Fzh" firstAttribute="leading" secondItem="cT9-nk-Xp8" secondAttribute="leading" id="Pzh-yI-2gq"/> <constraint firstItem="IPj-jj-q27" firstAttribute="centerX" secondItem="NKG-S3-3dE" secondAttribute="centerX" id="QQH-WM-Nkj"/> <constraint firstAttribute="bottom" secondItem="xz8-fG-Fzh" secondAttribute="bottom" id="SKX-wM-8qw"/> <constraint firstItem="IPj-jj-q27" firstAttribute="centerY" secondItem="NKG-S3-3dE" secondAttribute="centerY" priority="750" constant="-22" id="US4-Wl-926"/> <constraint firstItem="M48-Ji-2wd" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="cT9-nk-Xp8" secondAttribute="leading" constant="20" id="XS9-Sy-O6P"/> <constraint firstItem="NKG-S3-3dE" firstAttribute="leading" secondItem="cT9-nk-Xp8" secondAttribute="leading" id="hfr-B1-ZVB"/> <constraint firstItem="M48-Ji-2wd" firstAttribute="centerY" secondItem="cT9-nk-Xp8" secondAttribute="centerY" constant="20" id="jOY-kH-A0e"/> <constraint firstAttribute="trailing" secondItem="xz8-fG-Fzh" secondAttribute="trailing" id="kaA-A6-AQO"/> <constraint firstItem="Nje-Cx-Goc" firstAttribute="bottom" secondItem="M48-Ji-2wd" secondAttribute="bottom" id="q83-m3-toC"/> <constraint firstAttribute="trailing" secondItem="IPj-jj-q27" secondAttribute="trailing" constant="16" id="tFL-eu-jI7"/> <constraint firstAttribute="bottom" secondItem="NKG-S3-3dE" secondAttribute="bottom" id="tPl-4f-P4v"/> <constraint firstItem="NKG-S3-3dE" firstAttribute="top" secondItem="cT9-nk-Xp8" secondAttribute="top" id="wte-pZ-zhU"/> <constraint firstItem="IPj-jj-q27" firstAttribute="leading" secondItem="cT9-nk-Xp8" secondAttribute="leading" constant="16" id="yb2-74-gry"/> </constraints> <nil key="simulatedTopBarMetrics"/> <nil key="simulatedBottomBarMetrics"/> <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> <userDefinedRuntimeAttributes> <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> <integer key="value" value="2"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> <connections> <outlet property="coverBGLeadingConst" destination="Pzh-yI-2gq" id="wVr-nc-mGv"/> <outlet property="coverBGTrailConst" destination="kaA-A6-AQO" id="YHb-MM-Xit"/> <outlet property="coverImageView" destination="xz8-fG-Fzh" id="rDt-eA-xUR"/> <outlet property="helpButton" destination="Nje-Cx-Goc" id="Au6-it-2Uq"/> <outlet property="helpLabel" destination="M48-Ji-2wd" id="dfS-FV-TeN"/> <outlet property="labelToCenterConstraint" destination="US4-Wl-926" id="P3u-Z3-u3t"/> <outlet property="maskImageView" destination="NKG-S3-3dE" id="wXQ-8q-kEu"/> <outlet property="maskLabel" destination="IPj-jj-q27" id="SUE-Tl-DHg"/> <outlet property="nvrChannelNameContainer" destination="E37-JZ-yKU" id="CdG-LV-uFO"/> <outlet property="nvrChannelNameLabel" destination="leW-L6-18B" id="6Wf-Wj-Lej"/> </connections> <point key="canvasLocation" x="139" y="121"/> </view> </objects> </document>
12-09
在Tkinter中,组件Frame组件里面可能有多种原因,以下是一些常见原因及对应的解决办法: ### 未正确指定父组件 如果在创建组件时没有将Frame指定为其父组件,组件就会显示在Frame内。解决办法是在创建组件时,将Frame作为第一个参数传入。 ```python import tkinter as tk root = tk.Tk() # 创建一个Frame容器 frame = tk.Frame(root) frame.pack() # 正确指定Frame为父组件 label = tk.Label(frame, text="This is a label in the frame") label.pack() root.mainloop() ``` ### 未正确布局 如果使用了同的布局管理器,或者布局管理器的参数设置当,可能导致组件Frame内。要确保所有组件都使用相同的布局管理器(如`pack()`、`grid()`或`place()`),并且参数设置正确。 ```python import tkinter as tk root = tk.Tk() # 创建一个Frame容器 frame = tk.Frame(root) frame.pack() # 使用相同的布局管理器(这里使用pack) button = tk.Button(frame, text="Button in frame") button.pack() root.mainloop() ``` ### Frame大小问题 如果Frame的大小没有正确设置,可能会导致组件显示异常。可以通过设置Frame的`width`和`height`属性来确保其有足够的空间容纳组件。 ```python import tkinter as tk root = tk.Tk() # 创建一个有指定大小的Frame容器 frame = tk.Frame(root, width=200, height=200) frame.pack() label = tk.Label(frame, text="Label in frame") label.pack() root.mainloop() ``` ### 组件被覆盖 如果有其他组件或Frame重叠,可能会导致某些组件看起来Frame内。要确保组件的布局会相互覆盖。 ```python import tkinter as tk root = tk.Tk() # 创建一个Frame容器 frame = tk.Frame(root) frame.pack() # 确保组件布局重叠 button1 = tk.Button(frame, text="Button 1") button1.pack() button2 = tk.Button(frame, text="Button 2") button2.pack() root.mainloop() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值