<tfoot id='yHLxo'></tfoot>

<small id='yHLxo'></small><noframes id='yHLxo'>

        <bdo id='yHLxo'></bdo><ul id='yHLxo'></ul>
      <legend id='yHLxo'><style id='yHLxo'><dir id='yHLxo'><q id='yHLxo'></q></dir></style></legend>
    1. <i id='yHLxo'><tr id='yHLxo'><dt id='yHLxo'><q id='yHLxo'><span id='yHLxo'><b id='yHLxo'><form id='yHLxo'><ins id='yHLxo'></ins><ul id='yHLxo'></ul><sub id='yHLxo'></sub></form><legend id='yHLxo'></legend><bdo id='yHLxo'><pre id='yHLxo'><center id='yHLxo'></center></pre></bdo></b><th id='yHLxo'></th></span></q></dt></tr></i><div id='yHLxo'><tfoot id='yHLxo'></tfoot><dl id='yHLxo'><fieldset id='yHLxo'></fieldset></dl></div>

    2. iOS SDK UIViewContentModeScaleAspectFit 与 UIViewContentModeS

      时间:2023-10-23

      <tfoot id='GzTxZ'></tfoot>
        <bdo id='GzTxZ'></bdo><ul id='GzTxZ'></ul>

        <small id='GzTxZ'></small><noframes id='GzTxZ'>

      • <i id='GzTxZ'><tr id='GzTxZ'><dt id='GzTxZ'><q id='GzTxZ'><span id='GzTxZ'><b id='GzTxZ'><form id='GzTxZ'><ins id='GzTxZ'></ins><ul id='GzTxZ'></ul><sub id='GzTxZ'></sub></form><legend id='GzTxZ'></legend><bdo id='GzTxZ'><pre id='GzTxZ'><center id='GzTxZ'></center></pre></bdo></b><th id='GzTxZ'></th></span></q></dt></tr></i><div id='GzTxZ'><tfoot id='GzTxZ'></tfoot><dl id='GzTxZ'><fieldset id='GzTxZ'></fieldset></dl></div>

          <legend id='GzTxZ'><style id='GzTxZ'><dir id='GzTxZ'><q id='GzTxZ'></q></dir></style></legend>

              <tbody id='GzTxZ'></tbody>
              • 本文介绍了iOS SDK UIViewContentModeScaleAspectFit 与 UIViewContentModeScaleAspectFill的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想在 UITableViewCell 中使用提供 UIImageViewUITableViewCellStyleSubtitle 样式显示图像,以及两行文本,以及可选的附件视图.

                I have an image that I would like to display in a UITableViewCell using the UITableViewCellStyleSubtitle style that provides a UIImageView, and two lines of text, plus an optional accessory view.

                但是,当我将 UIImageView 的内容模式设置为 UIViewContentModeScaleAspectFitUIViewContentModeScaleAspectFill 时,似乎没有任何区别.这两种内容模式都只是显示整个图像,将文本向右移动以为图像腾出空间.

                However, when I set the content mode of the UIImageView to either of UIViewContentModeScaleAspectFit or UIViewContentModeScaleAspectFill, it appears to make no difference. Both of these content modes simply display the entire image, shifting the text to the right to make room for the image.

                有没有人举例说明这些在实践中的实际差异?文档说:

                Does anyone have any examples of how these actually differ in practice? The docs say:

                UIViewContentModeScaleAspectFit:
                Scales the content to fit the size of the view by maintaining the aspect ratio. Any     remaining area of the view’s bounds is transparent.
                
                UIViewContentModeScaleAspectFill:
                Scales the content to fill the size of the view. Some portion of the content may be  clipped to fill the view’s bounds.
                

                但这些内容模式的表现并不像宣传的那样.

                But these content modes don't appear to be behaving as advertised.

                我正在运行 SDK iOS 4.

                I'm running SDK iOS 4.

                推荐答案

                您看不到这些模式之间差异的原因是 UITableViewCell 自动调整其图像视图的大小以适应纵横比的图像.仅当视图的纵横比与图像的不同时,内容模式才会发挥作用.

                The reason you don't see a difference between those modes is that the UITableViewCell automatically sizes its image view to fit the aspect ratio of the image. The content modes only come into play when the view's aspect ratio is different from the image's.

                在您的自定义 UITableViewCell 类中覆盖 layoutSubviews 或自己创建一个图像视图(不要使用表格视图单元格提供的那个).

                Either override layoutSubviews in your custom UITableViewCell class or create an image view yourself (don't use the one that the table view cell provides).

                这篇关于iOS SDK UIViewContentModeScaleAspectFit 与 UIViewContentModeScaleAspectFill的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在 iOS 上将 UILabel 中的文本基线与不同的字体大小对齐? 下一篇:MKMapView 在 iOS 4 中忽略 centerOffset 的更新

                相关文章

                1. <tfoot id='zKP6H'></tfoot>

                    <small id='zKP6H'></small><noframes id='zKP6H'>

                  1. <i id='zKP6H'><tr id='zKP6H'><dt id='zKP6H'><q id='zKP6H'><span id='zKP6H'><b id='zKP6H'><form id='zKP6H'><ins id='zKP6H'></ins><ul id='zKP6H'></ul><sub id='zKP6H'></sub></form><legend id='zKP6H'></legend><bdo id='zKP6H'><pre id='zKP6H'><center id='zKP6H'></center></pre></bdo></b><th id='zKP6H'></th></span></q></dt></tr></i><div id='zKP6H'><tfoot id='zKP6H'></tfoot><dl id='zKP6H'><fieldset id='zKP6H'></fieldset></dl></div>
                  2. <legend id='zKP6H'><style id='zKP6H'><dir id='zKP6H'><q id='zKP6H'></q></dir></style></legend>

                    • <bdo id='zKP6H'></bdo><ul id='zKP6H'></ul>