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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:46:09+00:00 2026-06-12T08:46:09+00:00

Suppose you implement a custom table view and a custom view controller (which mostly

  • 0

Suppose you implement a custom table view and a custom view controller (which mostly mimics UITableViewControllers behaviour, but when initialized programmatically, …

@interface Foo : MyCustomTableViewController ...

Foo *foo = [[Foo alloc] init];

… foo.view is kind of class MyCustomTableView instead of UITableView:

// MyCustomTableView.h

@protocol MyTableViewDelegate <NSObject, UITableViewDelegate>

// ...

@end

@protocol MyTableViewDataSource <NSObject, UITableViewDataSource>

// ...

@end

@interface MyCustomTableView : UITableView

// ...

@end

// MyCustomTableViewController.h

@interface MyCustomTableViewController : UIViewController

// ...

@end

How should you implement/override init methods in correct order/ways so that you could create and use an instance of MyCustomTableView both by subclassing MyCustomTableViewController programmatically or from any custom nib file by setting custom class type to MyCustomTableView in Interface Builder?

It important to note that this is exactly how UITableView (mostly UIKit for that matter) works right now: a developer could create and use either programmatically or by creating from nib, whether be it File owner‘s main view or some subview in a more complex hierarchy, just assign data source or delegate and you’re good to go…

So far I managed to get this working if you subclass MyCustomTableViewController, where I will create an instance of MyCustomTableView and assign it to self.view in loadView method; but couldn’t figure out how initWithNibName:bundle:, initWithCoder:, awakeFromNib, awakeAfterUsingCoder:, or whatever else operates. I am lost in life cycle chain and end up with a black view/screen each time.

Thanks.

  • 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-12T08:46:11+00:00Added an answer on June 12, 2026 at 8:46 am

    This is how I solved my own issue:

    - (void)loadView
    {
        if (self.nibName) {
            // although docs states "Your custom implementation of this method should not call super.", I am doing it instead of loading from nib manually, because I am too lazy ;-)
            [super loadView];
        }
        else {
            self.view = // ... whatever UIView you'd like to create
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I use a custom :format to implement a gadget-oriented version of my site.
I need to implement the following: There is a table A which is supposed
I am developing an android application in which i have to implement custom rating
Suppose we were to implement a network application, such as a chat with a
Suppose I want to implement an interpreter for a functional language. I would like
I'm trying to implement java like url pattern matching in php. Suppose i have
I am supposed to implement a gesture-based menu in which you scroll through a
Would it be possible to implement a custom Thread class in Java (using JNI)
I'm writing a custom iterator for a Matrix class, and I want to implement
Suppose I have a custom collection class that provides some internal thread synchronization. For

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.