Q:

How to print formatted float in obj-c with number of digits from parameter

I know the way to set formatted float with specific number
NSLog(@"%.2f", myFloat);

What is the way to set parameter number?  Something like this
cell.lblOpenPrice.text = [NSString stringWithFormat:@"%.%if", trade.open_price, trade.digits];

A:

You should use an instance of NSNumberFormatter for this.  There are dozens of options, too many to discuss them here.  I. e. you can set the total number of digits (significant digits) or the number of integer and fraction digits as discussed here. 
NSNumberFormatter *formatter = [NSNumberFormatter new];
// Do the desired configuration
NSString *text = [formatter stringFromNumber:@(myFloat)];

