ios - UIImage's resizableImageWithCapInsets places a shadow on image -


I'm having trouble updating a UISegmentedControl : I've subclassed it I set it I am canceling both selected states and such a selection background for the state:

  #define kEdgeInsets UIEdgeInsetsMake (18, 18, 18, 18) UIImage * grayImage = [[UIImage v_imageNamed: @ "gray_rect"] resizableImageWithCapInsets: kEdgeInsets]; [Self setbackground image: State for Gray Image: UICOutrolStateOther Barmatrix: UIBarMetricsDefault]; UIImage * greenImage = [[UIImage v_image named: @ "green_rect"] resizableImageWithCapInsets: kEdgeInsets]; [Self setbackground image: State for green image: UIContolstate selected barometrics: UIBarMetricsDefault]; [Self Settinterler: [UIColor colorWithRed: 0.506 green: 0.514 blue: 0.525 alpha: 1.000]];   

Where are these PNGs I gray_rect  green_rect

Now, when I execute this code, I get a strange shadow on the split control, which is what we do not want Are there. It is as if the output looks like output

which is very strange, because no one Shadow is not original images, nor does UISegmentedControl add one (as far as I know).

Looking forward, I saw that if I say resizableImageWithCapInsets: , the image looks distorted (as one should expect), but without shadows.

otheroutput

Any thoughts? Because I'm really crazy on this, since I do not need this problem when using resizableImageWithCapInsets: UIButton

Thanks a lot

I thought it.

Frames of fractured controller height is 44, and background images were 75ptsx75pts. Since I set the top and bottom of the image up to 18pts, the OS was taking 18pts above and below the image pointing to the rest of the image and changing its shape. Here's a fun part, because the image has a gradient, the remaining image is ignored and the control is color that is there.

To use images with vertical shield, you get a base PNG with your exact equal height as your control ()

This is what I did, the image of 44x44 Resized and changed the insets to UIEdgeInsetsMake (0, 10, 0, 10) indicates that the image does not change in vertical size

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -