Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Now I'm just explaining how to show an image like iPhone library. Use <strong>UIScrollView</strong> instead of <strong>UITableView</strong>. I think this will be better!</p> <p>After getting all images in an array, try this code:</p> <pre><code>-(void)loadImagesOnScrollView { myScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 416.0)]; myScrollView.delegate = self; myScrollView.contentSize = CGSizeMake(320.0, 416.0); myScrollView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:myScrollView]; float horizontal = 8.0; float vertical = 8.0; for(int i=0; i&lt;[imageArray count]; i++) { if((i%4) == 0 &amp;&amp; i!=0) { horizontal = 8.0; vertical = vertical + 70.0 + 8.0; } buttonImage = [UIButton buttonWithType:UIButtonTypeCustom]; [buttonImage setFrame:CGRectMake(horizontal, vertical, 70.0, 70.0)]; [buttonImage setTag:i]; [buttonImage setImage:[imageArray objectAtIndex:i] forState:UIControlStateNormal]; [buttonImage addTarget:self action:@selector(buttonImagePressed:) forControlEvents:UIControlEventTouchUpInside]; [myScrollView addSubview:buttonImage]; horizontal = horizontal + 70.0 + 8.0; } [myScrollView setContentSize:CGSizeMake(320.0, vertical + 78.0)]; } </code></pre> <p>And you can handle each image like this</p> <pre><code>-(void)buttonImagePressed:(id)sender { NSLog(@"you have pressed : %d button",[sender tag]); } </code></pre> <p>(<strong>Note: First of all, this is up to you and your logics so please make your logic strong. Nobody can write everything here. If you are a beginner then please do study for sometime "All The Very Best"</strong>)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload