Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/46.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
Iphone UIButtonTypeCustom图像变形_Iphone_Ios_Objective C_Uibutton - Fatal编程技术网

Iphone UIButtonTypeCustom图像变形

Iphone UIButtonTypeCustom图像变形,iphone,ios,objective-c,uibutton,Iphone,Ios,Objective C,Uibutton,我正在构建一个自定义按钮,在正常状态下应该使用68x68png。 但图像看起来变形了:它应该是一个圆形,但它显示为椭圆形。 有没有任何提示或建议说明为什么会发生这种情况?奇怪的是,我尝试与另一个圆形png交换,220x220,一切正常。我希望发生此错误,因为图像大小,请检查图像大小是否为68x68 代码中没有错误。检查图像“dash\u pulsante\u attivo”分辨率。如果它小于68*68,它应该会被扭曲。更高的分辨率不会有失真问题 如果您想通过编程调整图像大小。您可以这样做。检查p

我正在构建一个自定义按钮,在正常状态下应该使用
68x68
png。 但图像看起来变形了:它应该是一个圆形,但它显示为椭圆形。
有没有任何提示或建议说明为什么会发生这种情况?奇怪的是,我尝试与另一个圆形png交换,
220x220
,一切正常。

我希望发生此错误,因为图像大小,请检查图像大小是否为68x68

代码中没有错误。

检查图像“dash\u pulsante\u attivo”分辨率。如果它小于68*68,它应该会被扭曲。更高的分辨率不会有失真问题


如果您想通过编程调整图像大小。您可以这样做。

检查png大小是否为68x68??如果大小合适,则意味着检查您是否在代码的其他位置更改此按钮框…您能否附加屏幕截图?检查图像“dash_pulsante_attivo”分辨率。抱歉,伙计们,这是一个愚蠢的错误,是我的错。如果图像大小合适,我检查了20次,但我检查的是finder(不是我在项目中导入的那个)。错误是我在我的项目中导入了原始图像-那更大。很尴尬:)对不起,伙计们,这是个愚蠢的错误,是我的错。如果图像大小合适,我检查了20次,但我检查的是finder(不是我在项目中导入的那个)。错误是我在我的项目中导入了原始图像-那更大。相当尴尬:)
customBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[customBtn setFrame:CGRectMake(200,200,68,68)];
UIImage *btnImage = [UIImage imageNamed:@"dash_pulsante_attivo"];
[customBtn setImage:btnImage forState:UIControlStateNormal];
[customBtn addTarget:self action:@selector(triggerMeasurement) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:customBtn];