UITableView does not respond to scrolling and touches

I created a custom UIView, and inside this UIView I add a UITableView, for example:

    treeView = [[UITableView alloc] initWithFrame:CGRectMake(0, 80, slider.frame.size.width, slider.frame.size.height - 80)];
    [treeView setDelegate:self];
    [treeView setDataSource:self];
    [self addSubview:treeView];
    [treeView release];

When the application loads, the table seems to load fine. However, when I try to scroll through a table, it does not respond to touches at all.

I also implement these methods for delegates / data sources:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

Does anyone know why this is so?

thank

+3
source share
4 answers

There are several possibilities:

  • Your user view or one of its supervisors is userInteractionEnabledset to NO.
  • There is another view on top of your user view or above the table view in the user view.
  • , , , ( clipToBounds = NO, , , , ). .
  • ( ) pointInside:withEvent: hitTest:withEvent:.
+20

, userInteractionEnabled - , . startFirstResponder , resignFirstResponder, . , , , . !

0

, ...

UITableView , , . , ! case, = 0.

, , pointInside: withEvent: hitTest: withEvent: NO!

0

, TabView , . , view.layer.transform = CATransform3DMakeScale(0.5,0.5,0); . , 2D toVC.view.layer.affineTransform = CGAffineTransformMakeScale(0.5, 0.5); . , , .

0

Source: https://habr.com/ru/post/1795331/


All Articles