Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:35:27+00:00 2026-06-03T08:35:27+00:00

I’d like to create a custom UITableViewCell subclass that loads content asynchronously using a

  • 0

I’d like to create a custom UITableViewCell subclass that loads content asynchronously using a URL connection. I’ve got a UITableViewCell subclass that handles all of this and a Nib file that defines the layout of the cell, but I’m having trouble linking the two. Here’s the code I’m using in tableView:cellForRowAtIndexPath:

static NSString *FavCellIdentifier = @"FavCellIdentifier";

FavouriteCell *cell = [tableView dequeueReusableCellWithIdentifier:FavCellIdentifier];

if (cell == nil)
{
    cell = [[[FavouriteCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:FavCellIdentifier] autorelease];
}

cell.requestURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@=%i", URL_GET_POST_STATUS,
                                           URL_PARAM_SERIAL,
                                           [[self.favourites objectAtIndex:indexPath.row] intValue]]];

return cell;

This gives a request URL to the UITableViewCell subclass, which handles loading in the setRequestURL method.

In the FavouriteCell class I’ve kept the initWithStyle:reuseIdentifier: method as is, and in the Nib I’ve set FavCellIdentifier as the identifier, and FavouriteCell as the class. Now how do I make the FavouriteCell class load the Nib?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:35:28+00:00Added an answer on June 3, 2026 at 8:35 am

    In order to use the nib/xib file, you’re going to have to instantiate the FavouriteCell differently.

    Try this:

    1. Make sure you’ve changed the type of your UITableViewCell to be a subclass of FavouriteCell instead of the default UITableViewCell in your xib. Do this by:
      • Clicking on the cell in the objects pane of Interface Builder.
      • Then, go to the Identity Inspector tab and make sure the Class selection under Custom Class lists FavouriteCell.
    2. Change the File's Owner property to be the UIViewController where you want to display your custom UITableViewCell (pretty much same process as step #1).
    3. Add an IBOutlet property of type FavouriteCell to your UIViewController. Name it whatever you like (I’m going to call it cell).
    4. Back in the xib of the UITableViewCell, connect the IBOutlet for the cell property in File’s Owner to your custom UITableViewCell.
    5. Use this code to load the cell programmatically:

    - (FavouriteCell *)tableView:(UITableView *)tableView 
           cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellId = @"FavCellId";
        FavouriteCell *cell = [tableView dequeueReusableCellWithIdentifier:CellId];
        if (!cell) {
            // Loads the xib into [self cell]
            [[NSBundle mainBundle] loadNibNamed:@"FavouriteCellNibName" 
                                          owner:self 
                                        options:nil];
            // Assigns [self cell] to the local variable
            cell = [self cell];
            // Clears [self cell] for future use/reuse
            [self setCell:nil];
        }
        // At this point, you're sure to have a FavouriteCell object
        // Do your setup, such as...
        [cell setRequestURL:[NSURL URLWithString:
                      [NSString stringWithFormat:@"%@?%@=%i", 
                          URL_GET_POST_STATUS, 
                          URL_PARAM_SERIAL, 
                          [[self.favourites objectAtIndex:indexPath.row] intValue]]
         ];
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.