ios - Could not find an overload for “init” that accepts the supplied arguments SWIFT -
ios - Could not find an overload for “init” that accepts the supplied arguments SWIFT -
i used code
self.navigationcontroller?.navigationbar.titletextattributes = [nsfontattributename: uifont(name: "helveticaneue-light", size: 20), nsforegroundcolorattributename: uicolor.whitecolor()] and i'm getting error "could not find overload “init” accepts supplied arguments"
uifont(name:size:) failable initializer -- homecoming nil if can't find font , crash app if disclose homecoming value. utilize code safely font , utilize it:
if allow font = uifont(name: "helveticaneue-light", size: 20) { self.navigationcontroller?.navigationbar.titletextattributes = [nsfontattributename: font, nsforegroundcolorattributename: uicolor.whitecolor()] } ios xcode swift
Comments
Post a Comment