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 的大小以适应底层图像而不移动它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)
                Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))
                Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)
                [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                <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>