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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:28:42+00:00 2026-05-22T17:28:42+00:00

I am trying to create some static table view cells to store my contents.

  • 0

I am trying to create some static table view cells to store my contents. I set up my nib file as seen in the picture:

Custom Table Cellenter image description here

In essence, I only have one static cell, containing a map view and a label.

Next I configure my Xcode files as follows:

Header:

@interface CarParkDetailViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource>
{
    UITableViewCell *infoCell;
    MKMapView *detailMapView;
    UILabel *addressLabel;

}

@property (nonatomic, retain) IBOutlet UITableViewCell *infoCell;
@property (nonatomic, retain) IBOutlet MKMapView *detailMapView;
@property (nonatomic, retain) IBOutlet UILabel *addressLabel;

@end

Implementation:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{
    // Return the number of sections.
    return 1;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    // Return the number of rows in the section.
    return 1;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{    
    return infoCell;
}

The code above doesn’t work. (Didn’t seem right in the first place). I am getting the following error

*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:’

Can anyone advise me on what the correct approach is in displaying my infoCell?

  • 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-22T17:28:42+00:00Added an answer on May 22, 2026 at 5:28 pm

    You have created a custom cell in a view controller, which is not possible. Use IB to create a custom cell and design your UI there. Then use the following code in your cellForRowAtIndex method:

    CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (cell == nil) {
        NSArray *nibObjects=[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:nil options:nil];
        for (id currentObject in nibObjects) {
            if ([currentObject isKindOfClass:[CustomCell class]]) {
                cell = (CustomCell *) currentObject;
                break;
            }
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create 3 table view cells using code (w/o nib). I
Hi friends. I'm trying to store some data into a 2-table-database. Here is its
I'm trying to create some HtmlHelper extensions and ran into a bit of a
I am trying to create some reusable components in Silverlight2 . The difficulty comes
I am trying to create some charts of data (eg http://www.amibroker.com/ ). Is there
I am trying to create some rules and facts on a certain situation. The
I am trying to create some global variables in a firefox extension. In my
I am trying to create some script variables in T-SQL as follows: /* Deployment
I am trying to create some dynamic html out of some data from db.
I'm trying to implement the WMD editor used on StackOverflow to create some basic

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.