The extension of the answer provided by Gui13 is slightly, with the parameters of the object.
The following code snippet demonstrates how to draw a set of UILabels 11x5.
// inline block - to be called as a private function UILabel *(^createLabel)(CGRect, NSString *, UIColor *) = ^UILabel *(CGRect rect, NSString *txt, UIColor *color) { UILabel *lbl = [UILabel new]; lbl.frame = rect; lbl.textColor = color; lbl.backgroundColor = [UIColor whiteColor]; lbl.font = [UIFont systemFontOfSize:30.f]; lbl.textAlignment = NSTextAlignmentCenter; lbl.text = txt; return lbl; }; // loop to create 11 rows of 5 columns over the whole screen float w = CGRectGetWidth([UIScreen mainScreen].bounds); float h = CGRectGetHeight([UIScreen mainScreen].bounds); float top = h / 10; //start at 10% from top float vOffset = h / 13; //space between rows: 7.6% of screen height NSArray *xFrom, *xTo; //columns to start at 5%, 20%, 40%, 60%, 80% xFrom = @[@(1.f/20), @(1.f/5), @(2.f/5), @(3.f/5), @(4.f/5)]; xTo = @[@(1.f/5-1.f/16), @(2.f/5-1.f/16), @(3.f/5-1.f/16), @(4.f/5-1.f/16), @(19.f/20)];
Here is the result for this code:

ishahak
source share