SWIFT OSX NSBezierPath Linewidth property not working -
i using following code draw line graph on custom nsview
for var index = 0; index < (datapointsarray.count - 1); index++ { nsbezierpath().linewidth = 20.0 nsbezierpath.strokelinefrompoint(datapointsarray[index], topoint: datapointsarray[index + 1]) }
this snippet contained within function called drawrect() within custom view.
the line draws correctly within coordinate system of view. however, line drawn @ same width (one pixel width) regardless of .linewidth setting (e.g., 5.0, 10.0, 20.0 etc) seems have no impact on line drawn).
is able advise might creating issue me. haven't been able find previous question raises issue.
nsbezierpath().linewidth = 20.0
the ()
means initializing new instance of class , set linewidth
20.0. should create variable , use draw path:
var bezierpath = nsbezierpath() bezierpath.linewidth = 20.0 bezierpath.movetopoint(datapointsarray[index]) bezierpath.linetopoint(datapointsarray[index + 1])
Comments
Post a Comment