macos - How is this frame size computed for a TextView - Stack Overflow

I've got the following xib: (minimal example stripped from a larger UI)<?xml version="1.0

I've got the following xib: (minimal example stripped from a larger UI)

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
    <dependencies>
        <deployment identifier="macosx"/>
        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <objects>
        <customObject id="-2" userLabel="File's Owner" customClass="AboutWindowController"/>
        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
        <window id="5">
            <rect key="contentRect" x="641" y="589" width="538" height="337"/>
            <view key="contentView" id="123">
                <rect key="frame" x="1" y="1" width="523" height="188"/>
                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                <subviews>
                    <textView id="28">
                        <rect key="frame" x="0.0" y="0.0" width="523" height="188"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                    </textView>
                </subviews>
            </view>
        </window>
    </objects>
</document>

After compilation, the NSTextView gets NSFrameSize with the height of 337, but I'd like to understand why. Why is it getting the height from the contentRect and not the frame of the view? Is there a specific documentation link I can find about it?

I found it surprising since this structure:

        <window id="5">
            <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
            <rect key="contentRect" x="641" y="589" width="538" height="337"/>
            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
            <view key="contentView" id="6">
                <rect key="frame" x="0.0" y="0.0" width="538" height="337"/>
                <subviews>
                    <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="0.0" id="13">
                        <rect key="frame" x="190" y="288" width="158" height="29"/>

does result in the height/width defined in the frame rect. (NSFrame is {190, 288}, {158, 29})

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745636074a4637398.html

相关推荐

  • macos - How is this frame size computed for a TextView - Stack Overflow

    I've got the following xib: (minimal example stripped from a larger UI)<?xml version="1.0

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信