ios - CALayer doesn't shrink downwards with anchorPoint and setAffineTransform -
i want draw real-time graph (x axis: time, y axis: speed using corelocation) auto-scale in animation. can't control transform of layer.
... view.layer.anchorpoint = cgpointmake(0.5, 0.5) ... plotshapelayer.setaffinetransform (cgaffinetransformmakescale(1.0, 0.5)) ...
i want shrink downwards😩
... view.layer.anchorpoint = cgpointmake(0.0, 0.0) ... plotshapelayer.setaffinetransform (cgaffinetransformmakescale(1.0, 0.5)) ...
the graph goes away...😩
... view.layer.anchorpoint = cgpointmake(0.0, 1.0) ... plotshapelayer.setaffinetransform (cgaffinetransformmakescale(1.0, 0.5)) ...
the graph go away...but graph appeared:
could me? overall code below:
class plotviewcontroller: uiviewcontroller { var shapelayers: [cashapelayer] = [] var pitchy: cgfloat = 12.0 var ymax: float = 0.0 ... override func viewwillappear(animated: bool) { ... view.layer.anchorpoint = cgpointmake(0.0, 1.0) } override func observevalueforkeypath(...) { ... let newvalue = float(model.value) if ymax < newvalue { // when sensed value exceeds display upper limit ymax = newvalue ... plotshapelayer in plotshapelayers { plotshapelayer.setaffinetransform (cgaffinetransformmakescale(1.0, 0.5)) } } ... }
finally, want code below , fit maximum change of value:
self.setaffinetransform (cgaffinetransformmakescale(1.0, newpitchy / originalpitchy))
thank help.
Comments
Post a Comment