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

    2. <small id='lqViu'></small><noframes id='lqViu'>

    3. 如何调整 UIImageView 的大小以适应底层图像而不移动它?

      How to resize a UIImageView to fit the underlying image without moving it?(如何调整 UIImageView 的大小以适应底层图像而不移动它?)
      <legend id='AWeBP'><style id='AWeBP'><dir id='AWeBP'><q id='AWeBP'></q></dir></style></legend>
        <i id='AWeBP'><tr id='AWeBP'><dt id='AWeBP'><q id='AWeBP'><span id='AWeBP'><b id='AWeBP'><form id='AWeBP'><ins id='AWeBP'></ins><ul id='AWeBP'></ul><sub id='AWeBP'></sub></form><legend id='AWeBP'></legend><bdo id='AWeBP'><pre id='AWeBP'><center id='AWeBP'></center></pre></bdo></b><th id='AWeBP'></th></span></q></dt></tr></i><div id='AWeBP'><tfoot id='AWeBP'></tfoot><dl id='AWeBP'><fieldset id='AWeBP'></fieldset></dl></div>
            <tbody id='AWeBP'></tbody>

              <bdo id='AWeBP'></bdo><ul id='AWeBP'></ul>
              • <tfoot id='AWeBP'></tfoot>

              • <small id='AWeBP'></small><noframes id='AWeBP'>

                本文介绍了如何调整 UIImageView 的大小以适应底层图像而不移动它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个 UIImageView,它的框架在加载图像之前设置,对于图像来说总是太大,所以当我尝试圆角时,例如,没有任何反应.

                I have a UIImageView whose frame, set before the image is loaded, is always too large for the image, so when I try to round the corners, for example, nothing happens.

                如何调整框架的大小,使其与底层图像的大小相同,同时确保 UIImageView 的中心点不会改变?

                How can I resize the frame so it's the same size as the underlying image, while ensuring that the center point of the UIImageView does not change?

                推荐答案

                如果改变 UIView 的边界,中心不会改变.

                If you change the bounds of a UIView the center will not change.

                CGRect bounds;
                
                bounds.origin = CGPointZero;
                bounds.size = newImage.size;
                
                imageView.bounds = bounds;
                imageView.image = newImage;
                

                这篇关于如何调整 UIImageView 的大小以适应底层图像而不移动它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
                When compiling for multiple targets in XCode, how do i ensure that certain files will not be included one target(在 XCode 中为多个目标编译时,我如何确保某些文件不会包含在一个目标中)
                Selecting text in mobile Safari on iPhone(在 iPhone 上的移动 Safari 中选择文本)
                Draggable UIImageView Partially Transparent amp; Irregular Shaped(可拖动的 UIImageView 部分透明 amp;不规则形状)
                How to set the resolution of a saved image from the UIImagePickerController(如何从 UIImagePickerController 设置保存图像的分辨率)
                Add UIImageview in Uitextview as in iMessage(像在 iMessage 中一样在 Uitextview 中添加 UIImageview)
                <i id='KQz8d'><tr id='KQz8d'><dt id='KQz8d'><q id='KQz8d'><span id='KQz8d'><b id='KQz8d'><form id='KQz8d'><ins id='KQz8d'></ins><ul id='KQz8d'></ul><sub id='KQz8d'></sub></form><legend id='KQz8d'></legend><bdo id='KQz8d'><pre id='KQz8d'><center id='KQz8d'></center></pre></bdo></b><th id='KQz8d'></th></span></q></dt></tr></i><div id='KQz8d'><tfoot id='KQz8d'></tfoot><dl id='KQz8d'><fieldset id='KQz8d'></fieldset></dl></div>
                  <bdo id='KQz8d'></bdo><ul id='KQz8d'></ul>
                    <tbody id='KQz8d'></tbody>
                    • <small id='KQz8d'></small><noframes id='KQz8d'>

                        <legend id='KQz8d'><style id='KQz8d'><dir id='KQz8d'><q id='KQz8d'></q></dir></style></legend>
                        1. <tfoot id='KQz8d'></tfoot>