iphone - How to round of CGFloat value -



iphone - How to round of CGFloat value -

possible duplicate: nsnumberformatter rounding float values

currently, calculate scaling factor using :

cgfloat scale = cgcontextgetctm(context).a; nslog(@"scale : %f", scale);

i receive floating point value : 0.124979, 0.249958, 0.499917. how can utilize roundf convert 0.125, 0.250, 0.500 respectively.

try this........

nslog(@"scale : %.3f", scale); nsstring *value = [nsstring stringwithformat:@"%.3f", thefloat];

stolen previous answer

iphone objective-c rounding cgcontext cgfloat

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -