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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:29:33+00:00 2026-06-07T18:29:33+00:00

I have a class like this: @interface ExerciseLogDetails : UIViewController<UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource> { where

  • 0

I have a class like this:

@interface ExerciseLogDetails : UIViewController<UIActionSheetDelegate, UITableViewDelegate, UITableViewDataSource> {

where I am trying to display some elements followed by a UITextView. The UITextView element is created on Interface Builder. When executing this code:

- (void)viewDidLoad {
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds       style:UITableViewStylePlain];
tableView.dataSource = self; 
tableView.delegate = self;
[self.view addSubview:self.tableView];
}

a table shows, but not the one I configured in Interface Builder. It is completely blank and unformatted. How can I access my table and populate it progrmmatically with data?

Thank you!

  • 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-07T18:29:35+00:00Added an answer on June 7, 2026 at 6:29 pm

    If you configured a tableView in IB you shouldn’t also create one programmatically, you should create @property (nonatomic, retain) IBOutlet UITableView *tableView; and connect it to the tableView you configured in IB.
    Try to set a breakpoint in the tableView’s
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    delegate method to see if this method get called.

    From Apple UITableView docs:

    A UITableView object must have an object that acts as a data source
    and an object that acts as a delegate; typically these objects are
    either the application delegate or, more frequently, a custom
    UITableViewController object. The data source must adopt the
    UITableViewDataSource protocol and the delegate must adopt the
    UITableViewDelegate protocol. The data source provides information
    that UITableView needs to construct tables and manages the data model
    when rows of a table are inserted, deleted, or reordered. The delegate
    provides the cells used by tables and performs other tasks, such as
    managing accessory views and selections.

    As u can see if u don’t set a dataSource to your tableView, the tableView will not know how and what to display, so nothing will happen.
    You can set one by calling tableView.dataSource = self; or in IB drag from your tableView to the file’s owner (that is your viewController that must implement the UITableViewDataSource Protocol)

    There are two methods in the UITableViewDataSource protocol that your dataSource must implement:

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section  
    

    and

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

    If u won’t implement those methods u will get a compiler warnings.
    You can have more control on how the tableView will look if you implement the UITableViewDelegate protocol – like row/header/footer height, selections and more…

    From Apple UITableView docs:

    UITableView overrides the layoutSubviews method of UIView so that it
    calls reloadData only when you create a new instance of UITableView or
    when you assign a new data source. Reloading the table view clears
    current state, including the current selection. However, if you
    explicitly call reloadData, it clears this state and any subsequent
    direct or indirect call to layoutSubviews does not trigger a reload.

    ReloadData get called when the tableView is created or when you assign a new dataSource (or when you explicitly call it of course..).
    This is when the tableView needs to know what to display (how many sections?, how many rows?, and which cell to display?) – So this is when numberOfRowsInSextion method called.

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

Sidebar

Related Questions

I have some classes like this: interface class IA { }; interface class IB
I have a proxied method in a MongoRepository extender class like this: public interface
I have an interface and a class implementing the interface like this: public interface
If I have a class/object like this #import <Foundation/Foundation.h> @interface anObject : NSObject {
I have a class that implements an interface like this; ... = new Location<ICafe>();
I have a class defined like this : @interface ServerCall : NSObject { //
I have a class called Textures that use holds some data like this //Textures.h
When we have something like this: interface ISomething<U,V> { ... } class Something<U,V> :
In my C++ application I have an interface that looks like this: class ICalculator
I have a class like this: @interface MyCollection : NSObject { NSMutableDictionary *data; }

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.