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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:21:42+00:00 2026-05-25T12:21:42+00:00

I am trying to setup a UITableViewController so that its tableView belongs to my

  • 0

I am trying to setup a UITableViewController so that its tableView belongs to my custom subclass. My loadView method currently looks like this:

- (void) loadView {
   MyTableViewSubclass* tv = [[[MyTableViewSubclass alloc]initWithFrame: CGRectZero style: UITableViewStylePlain]autorelease];
   self.view = tv;
   self.tableView = tv;
}

I am getting crashes later on that go away if I comment out the above method. So something is missing. But what?

Apple’s documentation says I should not be calling super in loadView. Which makes sense, because I want the view to have my class, not theirs.

Things I’ve tried that don’t help:

  • Rewrite the loadView method so that it is creating a plain UITableView. This tells me that the source of the problem does not lie in the implementation of my subclass.
  • Call [super viewDidLoad] from my loadView method. From Apple’s docs, it is unclear to me whether that method is called from loadView or afterwards. In any case, adding it to the end of my loadView method does not help.

One thing I’ve tried that does fix the problem, but defeats the purpose:

  • Comment out my loadView method.

EDIT: the crash is shown below. It happens after the user does some input. It also happens the same way if I am creating a plain UITableView instead of my subclass. There is a lot going on in the app, and something in my loadView override [or more likely, something missing from my override] is causing the state to be different, which in turn leads to the crash. But I don’t see a good way to track what is different.

2011-09-08 12:44:59.591 MyAppName[97649:207] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[MyTableViewSubclass scrollToRowAtIndexPath:atScrollPosition:animated:]: row (0) beyond bounds (0) for section (0).'
  • 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-25T12:21:43+00:00Added an answer on May 25, 2026 at 12:21 pm

    Turns out I need to set the dataSource and delegate of my tableView as a part of loading. So when I do this, everything works fine:

    - (void) loadView {
       MyTableViewSubclass* tv = [[[MyTableViewSubclass alloc]initWithFrame: CGRectZero style: UITableViewStylePlain]autorelease];
       tv.dataSource = self;
       tv.delegate = self;
       self.view = tv;
       self.tableView = tv;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying setup costum storege. Looks like all is ok. But there is the
After trying to setup my site for Google Webmaster Tools I found that my
I am trying to setup tracd for the project I am currently working on.
I'm trying setup a map that displays different pin colors depending on the type/class
im trying to setup two listeners for one button. Here is my code: This
I'm trying to setup a Python application that should automatically start when Linux boots.
Trying to setup a SQL stored procedure that if the variable passed to it
Trying to setup a Cron task that gets a file via FTP however seems
I am trying to setup an activity in Android that has 50% of the
Trying to setup Zend Framework as instructed in this manual $paths = array( realpath(dirname(__FILE__)

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.