Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.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 UIView&x27;定位不正确_Iphone_Objective C_Cocoa Touch - Fatal编程技术网

Iphone UIView&x27;定位不正确

Iphone UIView&x27;定位不正确,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我的控制器中有一个带2个UIView的nib和带IBOutlet的2个UILabel 我正在增加和减少这些UIView的高度,使其看起来像一个条形图,以指示什么东西是100%或更少-几乎像一个条形图 我对两个条使用以下方法(重用),但是第一个UIView(条)位置正确,但第二个太低-Y轴错误。然而,两者的高度都是正确的 有人有什么想法吗?我已经在interface builder中定位了它们,我在这个方法中实际做的就是更改高度(基本上) 我看你有这句话: float newYaxis = cur

我的控制器中有一个带2个UIView的nib和带IBOutlet的2个UILabel

我正在增加和减少这些UIView的高度,使其看起来像一个条形图,以指示什么东西是100%或更少-几乎像一个条形图

我对两个条使用以下方法(重用),但是第一个UIView(条)位置正确,但第二个太低-Y轴错误。然而,两者的高度都是正确的

有人有什么想法吗?我已经在interface builder中定位了它们,我在这个方法中实际做的就是更改高度(基本上)


我看你有这句话:

float newYaxis = currentPoint.x + (100 - newHeight); //Y axis must move down with the decreasing rating from 0 (100 %) down

使用currentPoint.x进行计算的位置。这应该是currentPoint.y吗?

我真不敢相信我忽略了这一点!谢谢你,伙计。我不明白为什么第一个“控件”的绘图是正确的,但第二个不是-一定是侥幸!你太棒了!
float newYaxis = currentPoint.x + (100 - newHeight); //Y axis must move down with the decreasing rating from 0 (100 %) down