problem with the table view inside a scrollview [d

2019-08-04 06:38发布

问题:

Possible Duplicate:
issue with tableview in iphone

I have the following:

.h file:

UITableView *catalogTable;
UIScrollView *scrollView;

.m file

- (void)viewDidLoad
{
    NSLog(@"BoiteAOutils");
    [super viewDidLoad];
    catalogTable.backgroundColor = [UIColor clearColor];
    catalogTable.layer.cornerRadius = 10.0;
    scrollView.layer.cornerRadius = 15;
   [self.view addSubview:scrollView];
    [scrollView setShowsVerticalScrollIndicator:NO];

    catalogTable.scrollEnabled = NO;
    catalogTable.layer.cornerRadius = 15;
    [scrollView addSubview:catalogTable];


    nameCatalog = [myAudiAppDelegate sharedAppDelegate].dataHandler.catalogueList;
    loadingView.hidden=YES;
}

I created a scrollView and a tableView in the xib file. Everything works great and the result looks:

http://i53.tinypic.com/dzgqx3.png

I'm very haapy with the result, the problem is that as soon I start scrolling the table up and down it doesn't move.I can't see the whole content of the table...only the cells showed in this picture. Where am I going wrong? Thank you:)

回答1:

You should never put a UITableView inside a UIScrollView. Quoting the documentation for a UIScrollView:

Important: You should not embed UIWebView or UITableView objects in UIScrollView objects. If you do so, unexpected behavior can result because touch events for the two objects can be mixed up and wrongly handled.

You should rethink how you want your layout. Hope that Helps!