uiscrollview - Displaying a grid of numbers in an iOS app -
I am trying to determine the best way to display a grid of numbers in an iOS app. I have 100 numbers to display so it will be 10 numbers per line. These are not clickable, only a read-only display. Required only because I'm showing a 10x10 grid on iOS, it needs to be scrollable and zoomable. What is a good way to approach? I'm new to iOS App Development.
Make just view and add them to the scroll view:
Const cgplot total_items = 10; Const CGFloat width = CGRectGetWidth (scrollView.bounds); Const CGFloat item_width = width / total_itsum; (NSInteger i = 0; i & lt; total_items; ++ i) {for (NSInteger j = 0; j & lt; total_items; ++ j) {UILabel * label = [[UILabel alloc] initWithFrame: CGRectMake (j * item_width, I * Aitm_vidhi, Aitm_vidhi, Aitm_vidth]]; Label.backgroundColor = [UIColor colorWithRed: arc4random_uniform (255) /255.0 beat: arc4random_uniform (255) /255.0 blue: arc4random_uniform (255) /255.0 alpha: 1.0]; Label.text = [NSString stringWithFormat: @ "% d", (int) (i * total_items + j + 1)]; [ScrollView Add Subview: label];}} ScrollView.contentSize = CGSizeMake (width, Aitm_vidhi * total_items);
Comments
Post a Comment