admin管理员组文章数量:1434921
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}
)
本文标签: macosHow is this frame size computed for a TextViewStack Overflow
版权声明:本文标题:macos - How is this frame size computed for a TextView - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745636073a2667563.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论