Saturday 15 June 2013

osx - How to set alphaValue in swift ? -



osx - How to set alphaValue in swift ? -

i have subclass of nsview , have no thought function should phone call alter alpha value . in objective c easy :

[self setalphavalue: 0.5];

but in swift couldn't find right function.

override func drawrect(dirtyrect: nsrect){ backgroundcolor.set() // self alphavalue(0.56) allow bezierpath = nsbezierpath(roundedrect:self.bounds, xradius:self.frame.size.width/2, yradius:self.frame.size.width/2) bezierpath.linewidth = 2.0 bezierpath.fill() }

thanks, , sorry bad english.

the objective-c code

[self setalphavalue: 0.5];

can written using property notation as

self.alphavalue = 0.5;

which straight translates swift as

self.alphavalue = 0.5

osx swift xcode6 nsview

No comments:

Post a Comment