ios - NSNumberFormatterCurrencyStyle Driving me insane -


i'm trying currency calculator work, , i've stumbled accross problem not know how solve.

the problem when type textfield can type on 100.20, problem arises when try using buttons.

whole numbers work fine click on dot button put's dot after 100.20 end 100.20. , whatever click after it.

if don't use nsnumberformatter works fine well.

here code snippets :

-(ibaction)buttondigitpressed:(id)sender {     mainnumber = 100.20;     nsnumberformatter *numberformatter = [[nsnumberformatter alloc] init];     [numberformatter setnumberstyle: nsnumberformattercurrencystyle];     mainfield.stringvalue = [numberformatter stringfromnumber:[nsnumber numberwithfloat: mainnumber]]; }  if(!userinthemiddleofenteringdecimal) {     userinthemiddleofenteringdecimal = yes;     mainfield.stringvalue= [mainfield.stringvalue stringbyappendingstring:@"."]; } 


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -