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 6846869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:40:33+00:00 2026-05-27T00:40:33+00:00

From my other question; Using UITableViewCell in a UITableView I’ve used the IB to

  • 0

From my other question; Using UITableViewCell in a UITableView I’ve used the IB to create a custom cell. Heres how my code is at the moment:

ViewRoutes (Original Table)

.h

@interface ViewRoutes : UIViewController {

    IBOutlet UITableView *tblRoute;
}

@property(nonatomic, retain) UITableView *tblRoute;

@end

.m

    #import "ViewRoutes.h"
#import "ViewRoutesCell.h"

@implementation ViewRoutes
@synthesize tblRoute;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (NSInteger)
numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell * aCell = [tableView dequeueReusableCellWithIdentifier:@"ViewRoutesCell"];
    if (aCell == nil)
    {


        NSArray *arr = [[NSBundle mainBundle] loadNibNamed:@"ViewRoutesCell" owner:self options:nil];

        for (NSObject *anObj in arr) {

            if([anObj isKindOfClass:[UITableViewCell class]]) {

                aCell = (UITableViewCell *)anObj;


            }
            return aCell;
        }
    }


}

and the .xib just has a UITableView on it.

The ViewRoutesCell (What I want to be the custom cell)

.h

#import <UIKit/UIKit.h>

@interface ViewRoutesCell : UITableViewCell {

    IBOutlet UITableViewCell *routesCell;
    NSMutableArray *arryRouteText;
    NSMutableArray *arryRouteImage;

    IBOutlet UILabel *lblRouteText;
    IBOutlet UILabel *lblRouteImage;

}

@property (nonatomic, retain) NSMutableArray *arryRouteText;
@property (nonatomic, retain) NSMutableArray *arryRouteImage;
@property (nonatomic, retain) UILabel *lblRouteText;
@property (nonatomic, retain) UILabel *lblRouteImage;

@end

The only thing i’ve done in the custom cell .m is synthesized the items

Then my custom cell xib i’ve got:

enter image description here

enter image description here

enter image description here

From here I get a little stuck, I can’t work out how to set the two label properties from my ViewRoutes.m (they will be coming from xml eventually, but for now just a mutablearray)

Am I doing this the right way?

Tom

Edit Just to let you know i’m loading the image string to a label for now, will be an image later

  • 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-05-27T00:40:34+00:00Added an answer on May 27, 2026 at 12:40 am

    In the declaration of

    UITableViewCell * aCell = [tableView dequeueReusableCellWithIdentifier:@"ViewRoutesCell"];
    

    you’re creating a UITableViewCell object. This does not know about your custom defined labels. You should change it to:

    ViewRoutesCell * aCell = (ViewRoutesCell *)[tableView dequeueReusableCellWithIdentifier:@"ViewRoutesCell"];
    

    Then, in the if clause, you should change

    aCell = (UITableViewCell *)anObj;
    

    to

    aCell = (ViewRoutesCell *)anObj;
    

    This will make the compiler recognize the object as being one of your specific cells, allowing you to access the label properties.

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using code from other question and i am getting the error as
my question is a bit different from the other ones.. i got an xsl-code
Following on from my other question, Help optimising this C (AVR) code? :) ,
Hello again ladies and gents! OK, following on from my other question on ASP.NET
This is linked to my other question when to move from a spreadsheet to
From another stackoverflow question, it seems that Android handles large bitmaps differently than other
I seem to be getting breakpoints from other programmers when checking out code... Where
I just have a quick best practice question regarding custom cells in a UITableView.
Somewhat related to my other question Should raw Hibernate annotated POJO's be returned from
I am using VFW unit from JEDI wrapper on WinAPI. The code I am

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.