Search code examples
iosuitableviewuiviewcontrollerchildviewcontroller

Trying to add a Tableview inside of a UIView. What am I doing wrong here?


I'm not sure how to approach this. I'm loading a separate table view controller nib file to my viewcontroller. How do I position it the way I want? Also, Is the below query all I need, or am I missing something? It keeps crashing on me.

- (void)viewDidLoad
{
    [super viewDidLoad];

    HSTableViewController *tableViews = [[HSTableViewController alloc]initWithNibName:@"HSTableViewController" bundle:nil];

    [self addChildViewController:tableViews];
    tableViews.view.frame = CGRectMake(0, 0, 100, 100);
    //tableViews.view.frame = self.view.bounds;
    [self.view addSubview:tableViews.view];
    [tableViews didMoveToParentViewController:self];

Solution

  • If anyone else needs this. See this tutorial I found on youtube that helped a lot. Thanks for all the help.

    http://www.youtube.com/watch?v=DzedmcFlm1c