Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to add photos from web API to individual rows in table
    text
    copied!<p>I have a UITable which I would like to add photos to on the left side of the cells. The photos are currently coming from my showStream method (see code below). All of the photos get added to just the first cell of my UITable. How can I get each photo added to a single cell so that each cell in my UITable shows one of the images (images separated by the rows)? Can I call the UITableViewCell method and somehow put a single photo in each row?</p> <pre><code>-(void)showStream:(NSArray*)stream { // 1 remove old photos for (UIView* view in _tableView.subviews) { [view removeFromSuperview]; } // 2 add new photo views for (int i=0;i&lt;[stream count];i++) { NSDictionary* photo = [stream objectAtIndex:i]; PhotoView* photoView = [[PhotoView alloc] initWithIndex:i andData:photo]; photoView.delegate = self; </code></pre> <p>// here I set up the cell UITableViewCell *cell = [_tableView dequeueReusableCellWithIdentifier:@"MyIdentifier"];</p> <pre><code> if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"MyIdentifier"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObject:photo]; } } </code></pre> <p>Here is the tableView method....can I pass something in where the question marks are?</p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { can I get the photo array inside this method? } return cell; } </code></pre>
 

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