I only have a scene with following variables:
我只有一个包含以下变量的场景:
widthOfScene = self.size.width
heightOfScene = self.size.height
var constLabelPosition = CGPoint(x:witdhOfScene*0.6, y: heightOfScene*0.95)
var dynamLabelPosition = CGPoint(x: constLabelPosition.x * 0.1, y: constLabelPosition.y)
I want my dynamLabel to be just always 10% right of my constLabel even if I decide to change the constLabelPosition
in a few months. My code is not working. dynamLabel
is always just in the middle of the constLabel
...is there a way to implement such dynamic label position?
即使我决定在几个月内改变constLabelPosition,我希望我的dynamLabel总是在我的constLabel的10%右边。我的代码不起作用。 dynamLabel总是位于constLabel的中间......有没有办法实现这样的动态标签位置?
1 个解决方案
#1
2
I'm sorry, but this seems like a simple miscalculation of x position of dynamicLabelPosition.
对不起,这似乎是对dynamicLabelPosition的x位置的一个简单的错误估计。
You sure you didn't mean :
你确定你不是故意的:
var dynamLabelPosition = CGPoint(x: constLabelPosition.x + constLabelPosition.x * 0.1, y: constLabelPosition.y)
#1
2
I'm sorry, but this seems like a simple miscalculation of x position of dynamicLabelPosition.
对不起,这似乎是对dynamicLabelPosition的x位置的一个简单的错误估计。
You sure you didn't mean :
你确定你不是故意的:
var dynamLabelPosition = CGPoint(x: constLabelPosition.x + constLabelPosition.x * 0.1, y: constLabelPosition.y)