xcode - Swift 4 Functions Button properties -
i new swift. trying create func
func roundedbutton(buttonik: string) { buttonik.clipstobounds = true buttonik.layer.cornerradius = 10 buttonik.layer.maskedcorners = [.layermaxxminycorner, .layerminxminycorner, .layermaxxmaxycorner] } than call it
roundedbutton(buttonik: "buttontop") and have output
buttontop.clipstobounds = true buttontop.layer.cornerradius = 10 buttontop.layer.maskedcorners = [.layermaxxminycorner, .layerminxminycorner, .layermaxxmaxycorner] i getting these errors
value of type 'string' has no member 'clipstobounds' value of type 'string' has no member 'layer' thank :)
i think issue confusing name of button object represents button. change routine to:
func roundedbutton(button: uibutton) { button.clipstobounds = true button.layer.cornerradius = 10 button.layer.maskedcorners = [.layermaxxminycorner, .layerminxminycorner, .layermaxxmaxycorner] } then call passing button want apply these properties to... instead of passing string.
Comments
Post a Comment