ios - Custom Swift NSNumberFormatterStyle -


i'm using ios charts chart data in swift ios app including times. times stored in int variables seconds people don't want see 1 hour , 45 minutes on y axis 6300 need format it.

ios charts lets set use nsnumberformatter so

var formatter: nsnumberformatter = nsnumberformatter() formatter.numberstyle = nsnumberformatterstyle.spelloutstyle chartholder.leftaxis.valueformatter = formatter 

but none of styles available suitable need. need take number of seconds , turn into, example, 1h 45m. want make custom nsnumberformatterstyle... how do this?

any appreciated.

this won't work nsnumberformatterstyle - options limited you. should do, subclass nsnumberformatter, , override stringfromnumber: function. there can string manipulation want.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -