how to allow the user to change font Swift -


i building application display details , want allow user change font of these details have done researches of them go device's settings , change font there so, there way have similar settings inside application

thank in advance

update

i used following slider didnt works

@ibaction func fontslider(sender: anyobject) {     var currentvalue  = int(slider.value) int     println(currentvalue)     ingredients.font = uifont(name: ingredients.font.fontname, size: currentvalue)        } 

you can make use of appearance proxies uilabel , uitextview, , save font in nsuserdefaults.

when user selects font (you have create interface, rizwan's answer using uipickerview idea), can save font , set labels , textviews.

func setdefaultfont (font: uifont) {     nsuserdefaults.standarduserdefaults().setobject(font, forkey: "defaultfont")      uilabel.appearance().font = font;      uitextview.appearance().font = font; } 

you might want check saved font , set it. can called in -viewdidload method of root viewcontroller or in app delegate.

func checkandsetdefaultfont () {     let font: uifont = (nsuserdefaults.standarduserdefaults().objectforkey("defaultfont") as? uifont)!      uilabel.appearance().font = font;      uilabel.appearance().font = font; } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -