Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在UIButton背景中不拉伸图像_Ios_Objective C_Background_Uibutton_Scale - Fatal编程技术网

Ios 如何在UIButton背景中不拉伸图像

Ios 如何在UIButton背景中不拉伸图像,ios,objective-c,background,uibutton,scale,Ios,Objective C,Background,Uibutton,Scale,我有一个uibutton,它的大小是100x100,背景图像的大小是不同的高度和宽度,所以图像是拉伸的。我怎样才能防止这种情况我设置了这样的背景图像 [lc_按钮设置背景图像:位置\u状态背景:uicontrol状态正常] 另外,由于其他问题,我不想使用setImage。我现在知道imageEdgeInsets并设置ImageIt工作。为什么不使用aspect fit模式?如@TejaNandamuri所述,您是否尝试过更改按钮imageView的内容模式?Aspect fit或Aspect F

我有一个uibutton,它的大小是100x100,背景图像的大小是不同的高度和宽度,所以图像是拉伸的。我怎样才能防止这种情况我设置了这样的背景图像

[lc_按钮设置背景图像:位置\u状态背景:uicontrol状态正常]


另外,由于其他问题,我不想使用setImage。我现在知道imageEdgeInsets并设置ImageIt工作。

为什么不使用aspect fit模式?如@TejaNandamuri所述,您是否尝试过更改按钮imageView的内容模式?Aspect fit或Aspect Fill听起来像答案您可以使用Assets.xAssets的切片选项。有关详细信息,请打开此URL:根据按钮边框大小调整图像大小并重新添加为什么不使用aspect fit模式?如@TejaNandamuri所述,您是否尝试过更改按钮图像视图的内容模式?Aspect fit或Aspect Fill听起来像答案您可以使用Assets.xAssets的切片选项。有关更多详细信息,请打开此URL:根据按钮框大小调整图像大小,然后再次添加