Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/99.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 UIImageView';s的宽度设置失败_Iphone_Ios_Cocoa Touch_Uiimageview - Fatal编程技术网

Iphone UIImageView';s的宽度设置失败

Iphone UIImageView';s的宽度设置失败,iphone,ios,cocoa-touch,uiimageview,Iphone,Ios,Cocoa Touch,Uiimageview,我在Size Inspector中将UIImageView的宽度设置为0 -viewDidLoad { ... //smallTiao is the outlet of UIImageView NSLog(@"smallTiao 's width %f",self.smallTiao.frame.size.width); } Xcode日志小条的宽度为0.000000 但实际上,在iPad模拟器中,图像视图的宽度不是0。我不知道为什么 更新 问题解决了。我删除了图像视图。我添加了一

我在Size Inspector中将UIImageView的宽度设置为0

-viewDidLoad
{
  ...
  //smallTiao is the outlet of UIImageView
  NSLog(@"smallTiao 's width %f",self.smallTiao.frame.size.width);
}
Xcode日志小条的宽度为0.000000 但实际上,在iPad模拟器中,图像视图的宽度不是0。我不知道为什么

更新
问题解决了。我删除了图像视图。我添加了一个新的图像视图。然后一切正常。

您设置0和获得0.0000000并不都是一样的,(减去int和float)?您是从代码创建图像视图还是使用“蹩脚”界面生成器?@H2CO3我在Interface Builder中创建图像视图。为什么要使用0宽度的图像视图?@Nimingzheze2008,您确定它已正确连接到类的实际属性吗?如果不是,则
self.smallTiao
nil
,由此发送给它的任何其他消息返回0。