<tfoot id='rUik8'></tfoot>

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

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

      • <bdo id='rUik8'></bdo><ul id='rUik8'></ul>
    1. 使用 capinsets 调整图像大小

      时间:2023-05-30

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

        1. <small id='GlR5D'></small><noframes id='GlR5D'>

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

              • 本文介绍了使用 capinsets 调整图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                I have setup a button like this:

                // Create facebook login button
                facebookLoginButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 20, 300,50)];
                facebookLoginButton.autoresizingMask = UIViewAutoresizingFlexibleWidth;
                //NSLog(@"facebook button view height is %f",facebookLoginButton.bounds.size.height);
                //NSLog(@"facebook button view width is %f",facebookLoginButton.bounds.size.width);
                
                UIImage *facebookButton = [[UIImage imageNamed:@"FacebookLogin"]
                                           resizableImageWithCapInsets:UIEdgeInsetsMake(16,140,86,92)];
                [facebookLoginButton setBackgroundImage:facebookButton forState:UIControlStateNormal];
                

                I have created an image in Photoshop for the button which is 200(w)x100(h)px. Firstly would this be the correct size for the retina image used on an iphone4/5 for a button fitting into the login frame which is 50 in height? The other width does not matter as being stretched.

                Secondly, below is an example image. I cannot seem to work out the correct insets for the 'resizableImageWithCapInsets:UIEdgeInsetsMake'. How do I work this out? Is there a tutorial anywhere on how to do this, other than the Android example I have seen linked from SO.

                解决方案

                Since you are setting the frame of the button explicitly, and since you are creating your own image, you do not need a resizable image. Your button is 300 by 50 so make a 300 by 50 image (along with a 600 by 100 image for a double-resolution device) and set the background image of the button to it.

                However, I'll also give a code example. For the image that you actually give, if you name it FacebookLogin@2x.png so that it is used as the double-resolution image, the value you want to use is resizableImageWithCapInsets:UIEdgeInsetsMake(0,50,0,50). Here is the result:

                这篇关于使用 capinsets 调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:检测 iPhone 5 及其下方的任何 iOS 设备 下一篇:EKAlarm 不会在 iOS 5 中设置

                相关文章

                最新文章

              • <legend id='kXEN6'><style id='kXEN6'><dir id='kXEN6'><q id='kXEN6'></q></dir></style></legend>

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

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