Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to populate a table view with Youtube thumbnails?

AshtashooterAshtashooter MalaysiaPosts: 25New Users @
I've created a table View and added a JSON Model library to my project, which I got from this link! What I want is to populate my table cells with Youtube thumbnails (only most popular).

Here is my code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 50;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
    }
    //Configure cell
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}

I'm getting confused and I don't know what to do. I hope someone help me with some simple explanation or example so that I can understand because I'm a noob ;)

Thank you

Replies

  • RickSDKRickSDK Posts: 1,240Registered Users @ @ @ @
    which part is not currently working the way you expect it to?
  • AshtashooterAshtashooter MalaysiaPosts: 25New Users @
    What code do I need to add to show like 50 Youtube thumbnails in the table cells? In other words, how to fetch the thumbnails from JSON model and make each thumbnail clickable to open the video in another view controller?
  • RickSDKRickSDK Posts: 1,240Registered Users @ @ @ @
    you are basically asking, "I have an idea for a really complicated app. can someone simply paste into this forum the complete code to make it work?"
  • C6Silver05C6Silver05 SeattlePosts: 632New Users @ @ @
    I would assume you are not looking to get the thumbnail itself from JSON but rather a URL. You need to make that call prior to the table and load the results of the JSON into an array. Loop through the array using the URLs to bring in the appropriate content.
  • AshtashooterAshtashooter MalaysiaPosts: 25New Users @
    This is not what I'm here for RickSDK. You totally misunderstood me. I would've hired a coder to do the whole thing for me if that was the case. I just got stuck trying to get the thumbnail after doing some failed attempts. I don't want the "complete code"! All I want is something like a small code or some simple explanation just to put me on the right track.
  • AshtashooterAshtashooter MalaysiaPosts: 25New Users @
    Thank you C6Silver05 for your simple and insightful explanation. I will definitely look into that. Cheers!
Sign In or Register to comment.