Search code examples
iphoneiosipadmessageui

programmatically added tablview's scroll disabled


I added tableview to scrollview programmatically but it is not scrolling. While i tried the same using XIB. but it is working fine.

here is my code

CGRect frame = CGRectMake(30, 30.0f, 900, 300.0f);

eappTable = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]  style:UITableViewStylePlain];

eappTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

eappTable.delegate = self;

eappTable.dataSource = self;

eappTable.scrollEnabled = YES;

eappTable.scrollsToTop = YES;

[eappTable reloadData];

[scrollView addSubview:eappTable];

Solution

  • eappTable = [[UITableView alloc] nitWithFrame:YourSize style:Table_Style]];
    eappTable.delegate = self;
    eappTable.dataSource = self;
    eappTable.scrollEnabled = YES;
    [scrollView addSubview:eappTable];
    

    And set self.scrollView.contentSize