UIColor not working with RGBA value, iOS 7 - Swift -
i trying alter text colour in uitextfield using next code (rgba value) appears white, or clear, i'm not sure background white itself.
passwordtextfield.textcolor = uicolor(red: cgfloat(202.0), green: cgfloat(228.0), blue: cgfloat(230.0), alpha: cgfloat(100.0)) passwordtextfield.returnkeytype = uireturnkeytype.done passwordtextfield.placeholder = "password" passwordtextfield.backgroundcolor = uicolor.clearcolor() passwordtextfield.borderstyle = uitextborderstyle.roundedrect passwordtextfield.font = uifont(name: "avenir next", size: 14) passwordtextfield.textalignment = nstextalignment.center passwordtextfield.securetextentry = true
rgb values uicolor between 0 , 1 (see the documentation "specified value 0.0 1.0")
you need split numbers 255:
passwordtextfield.textcolor = uicolor(red: cgfloat(202.0/255.0), green: cgfloat(228.0/255.0), blue: cgfloat(230.0/255.0), alpha: cgfloat(1.0)) another thing, don't need create cgfloats:
passwordtextfield.textcolor = uicolor(red:202.0/255.0, green:228.0/255.0, blue:230.0/255.0, alpha:1.0) ios swift uicolor
No comments:
Post a Comment